From 07462fffb4968e04f91bf9e07df245a8c228d36e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 17 May 2022 01:44:39 +0000 Subject: [PATCH] CodeGen from PR 19094 in Azure/azure-rest-api-specs Merge a2d962c1bba59c27b3f97d1a14a957edbf211fd0 into 63353171621815e17db46a3075a79c9af60a0831 --- sdk/compute/azure-mgmt-compute/_meta.json | 6 +- .../compute/_compute_management_client.py | 118 +- .../compute/aio/_compute_management_client.py | 118 +- .../azure/mgmt/compute/models.py | 2 +- .../v2015_06_15/_compute_management_client.py | 14 +- .../compute/v2015_06_15/_configuration.py | 12 +- .../mgmt/compute/v2015_06_15/_metadata.json | 4 +- .../mgmt/compute/v2015_06_15/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2015_06_15/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 61 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 76 +- .../_virtual_machine_images_operations.py | 66 +- ...irtual_machine_scale_set_vms_operations.py | 164 +- .../_virtual_machine_scale_sets_operations.py | 250 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 227 +- .../_availability_sets_operations.py | 170 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 167 +- .../_virtual_machine_images_operations.py | 180 +- ...irtual_machine_scale_set_vms_operations.py | 362 +- .../_virtual_machine_scale_sets_operations.py | 554 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 507 +- .../v2016_03_30/_compute_management_client.py | 14 +- .../compute/v2016_03_30/_configuration.py | 12 +- .../mgmt/compute/v2016_03_30/_metadata.json | 4 +- .../mgmt/compute/v2016_03_30/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2016_03_30/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 75 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 76 +- .../_virtual_machine_images_operations.py | 66 +- ...irtual_machine_scale_set_vms_operations.py | 164 +- .../_virtual_machine_scale_sets_operations.py | 250 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 240 +- .../_availability_sets_operations.py | 207 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 167 +- .../_virtual_machine_images_operations.py | 180 +- ...irtual_machine_scale_set_vms_operations.py | 362 +- .../_virtual_machine_scale_sets_operations.py | 554 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 543 +- .../_compute_management_client.py | 14 +- .../v2016_04_30_preview/_configuration.py | 12 +- .../v2016_04_30_preview/_metadata.json | 4 +- .../compute/v2016_04_30_preview/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../v2016_04_30_preview/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 73 +- .../aio/operations/_disks_operations.py | 137 +- .../aio/operations/_images_operations.py | 81 +- .../aio/operations/_snapshots_operations.py | 137 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 76 +- .../_virtual_machine_images_operations.py | 66 +- ...irtual_machine_scale_set_vms_operations.py | 185 +- .../_virtual_machine_scale_sets_operations.py | 270 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 260 +- .../_availability_sets_operations.py | 203 +- .../operations/_disks_operations.py | 311 +- .../operations/_images_operations.py | 192 +- .../operations/_snapshots_operations.py | 311 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 167 +- .../_virtual_machine_images_operations.py | 180 +- ...irtual_machine_scale_set_vms_operations.py | 404 +- .../_virtual_machine_scale_sets_operations.py | 595 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 584 +- .../v2017_03_30/_compute_management_client.py | 14 +- .../compute/v2017_03_30/_configuration.py | 12 +- .../mgmt/compute/v2017_03_30/_metadata.json | 4 +- .../mgmt/compute/v2017_03_30/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2017_03_30/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 75 +- .../aio/operations/_disks_operations.py | 137 +- .../aio/operations/_images_operations.py | 81 +- .../operations/_resource_skus_operations.py | 18 +- .../aio/operations/_snapshots_operations.py | 137 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 76 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 28 +- ...machine_scale_set_extensions_operations.py | 69 +- ...e_scale_set_rolling_upgrades_operations.py | 56 +- ...irtual_machine_scale_set_vms_operations.py | 184 +- .../_virtual_machine_scale_sets_operations.py | 293 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 331 +- .../_availability_sets_operations.py | 207 +- .../operations/_disks_operations.py | 311 +- .../operations/_images_operations.py | 192 +- .../operations/_resource_skus_operations.py | 41 +- .../operations/_snapshots_operations.py | 311 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 167 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 73 +- ...machine_scale_set_extensions_operations.py | 159 +- ...e_scale_set_rolling_upgrades_operations.py | 122 +- ...irtual_machine_scale_set_vms_operations.py | 403 +- .../_virtual_machine_scale_sets_operations.py | 642 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 740 +- .../v2017_09_01/_compute_management_client.py | 12 +- .../compute/v2017_09_01/_configuration.py | 12 +- .../mgmt/compute/v2017_09_01/_metadata.json | 4 +- .../mgmt/compute/v2017_09_01/_version.py | 2 +- .../aio/_compute_management_client.py | 10 +- .../compute/v2017_09_01/aio/_configuration.py | 12 +- .../operations/_resource_skus_operations.py | 18 +- .../operations/_resource_skus_operations.py | 41 +- .../v2017_12_01/_compute_management_client.py | 14 +- .../compute/v2017_12_01/_configuration.py | 12 +- .../mgmt/compute/v2017_12_01/_metadata.json | 4 +- .../mgmt/compute/v2017_12_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2017_12_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 85 +- .../aio/operations/_images_operations.py | 100 +- .../operations/_log_analytics_operations.py | 43 +- .../v2017_12_01/aio/operations/_operations.py | 18 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 76 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 28 +- ...machine_scale_set_extensions_operations.py | 69 +- ...e_scale_set_rolling_upgrades_operations.py | 56 +- ...irtual_machine_scale_set_vms_operations.py | 245 +- .../_virtual_machine_scale_sets_operations.py | 360 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 350 +- .../_availability_sets_operations.py | 239 +- .../operations/_images_operations.py | 233 +- .../operations/_log_analytics_operations.py | 90 +- .../v2017_12_01/operations/_operations.py | 39 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 167 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 73 +- ...machine_scale_set_extensions_operations.py | 159 +- ...e_scale_set_rolling_upgrades_operations.py | 122 +- ...irtual_machine_scale_set_vms_operations.py | 528 +- .../_virtual_machine_scale_sets_operations.py | 797 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 781 +- .../v2018_04_01/_compute_management_client.py | 14 +- .../compute/v2018_04_01/_configuration.py | 12 +- .../mgmt/compute/v2018_04_01/_metadata.json | 4 +- .../mgmt/compute/v2018_04_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2018_04_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2018_04_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 73 +- .../aio/operations/_snapshots_operations.py | 145 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 28 +- ...machine_scale_set_extensions_operations.py | 73 +- ...e_scale_set_rolling_upgrades_operations.py | 64 +- ...irtual_machine_scale_set_vms_operations.py | 309 +- .../_virtual_machine_scale_sets_operations.py | 404 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 371 +- .../_availability_sets_operations.py | 235 +- .../operations/_disks_operations.py | 307 +- .../operations/_images_operations.py | 231 +- .../operations/_log_analytics_operations.py | 90 +- .../v2018_04_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 198 +- .../operations/_snapshots_operations.py | 307 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 201 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 73 +- ...machine_scale_set_extensions_operations.py | 157 +- ...e_scale_set_rolling_upgrades_operations.py | 118 +- ...irtual_machine_scale_set_vms_operations.py | 560 +- .../_virtual_machine_scale_sets_operations.py | 815 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 725 +- .../v2018_06_01/_compute_management_client.py | 14 +- .../compute/v2018_06_01/_configuration.py | 12 +- .../mgmt/compute/v2018_06_01/_metadata.json | 4 +- .../mgmt/compute/v2018_06_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2018_06_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_galleries_operations.py | 83 +- .../_gallery_image_versions_operations.py | 73 +- .../operations/_gallery_images_operations.py | 71 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2018_06_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 73 +- .../aio/operations/_snapshots_operations.py | 145 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 28 +- ...machine_scale_set_extensions_operations.py | 73 +- ...e_scale_set_rolling_upgrades_operations.py | 88 +- ...irtual_machine_scale_set_vms_operations.py | 309 +- .../_virtual_machine_scale_sets_operations.py | 403 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 397 +- .../_availability_sets_operations.py | 235 +- .../operations/_disks_operations.py | 307 +- .../operations/_galleries_operations.py | 192 +- .../_gallery_image_versions_operations.py | 163 +- .../operations/_gallery_images_operations.py | 159 +- .../operations/_images_operations.py | 231 +- .../operations/_log_analytics_operations.py | 90 +- .../v2018_06_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 198 +- .../operations/_snapshots_operations.py | 307 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 201 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 73 +- ...machine_scale_set_extensions_operations.py | 157 +- ...e_scale_set_rolling_upgrades_operations.py | 157 +- ...irtual_machine_scale_set_vms_operations.py | 565 +- .../_virtual_machine_scale_sets_operations.py | 814 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 771 +- .../v2018_09_30/_compute_management_client.py | 12 +- .../compute/v2018_09_30/_configuration.py | 12 +- .../mgmt/compute/v2018_09_30/_metadata.json | 4 +- .../mgmt/compute/v2018_09_30/_version.py | 2 +- .../aio/_compute_management_client.py | 10 +- .../compute/v2018_09_30/aio/_configuration.py | 12 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_snapshots_operations.py | 145 +- .../operations/_disks_operations.py | 307 +- .../operations/_snapshots_operations.py | 307 +- .../v2018_10_01/_compute_management_client.py | 14 +- .../compute/v2018_10_01/_configuration.py | 12 +- .../mgmt/compute/v2018_10_01/_metadata.json | 4 +- .../mgmt/compute/v2018_10_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2018_10_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2018_10_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 73 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 28 +- ...machine_scale_set_extensions_operations.py | 73 +- ...e_scale_set_rolling_upgrades_operations.py | 88 +- ...irtual_machine_scale_set_vms_operations.py | 309 +- .../_virtual_machine_scale_sets_operations.py | 403 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 397 +- .../_availability_sets_operations.py | 235 +- .../operations/_images_operations.py | 231 +- .../operations/_log_analytics_operations.py | 90 +- .../v2018_10_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 198 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 201 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 73 +- ...machine_scale_set_extensions_operations.py | 157 +- ...e_scale_set_rolling_upgrades_operations.py | 157 +- ...irtual_machine_scale_set_vms_operations.py | 565 +- .../_virtual_machine_scale_sets_operations.py | 814 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 771 +- .../v2019_03_01/_compute_management_client.py | 14 +- .../compute/v2019_03_01/_configuration.py | 12 +- .../mgmt/compute/v2019_03_01/_metadata.json | 4 +- .../mgmt/compute/v2019_03_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2019_03_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- .../_dedicated_host_groups_operations.py | 73 +- .../operations/_dedicated_hosts_operations.py | 94 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_galleries_operations.py | 83 +- ...gallery_application_versions_operations.py | 73 +- .../_gallery_applications_operations.py | 71 +- .../_gallery_image_versions_operations.py | 73 +- .../operations/_gallery_images_operations.py | 71 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2019_03_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 73 +- .../aio/operations/_snapshots_operations.py | 145 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 28 +- ...machine_scale_set_extensions_operations.py | 73 +- ...e_scale_set_rolling_upgrades_operations.py | 88 +- ...irtual_machine_scale_set_vms_operations.py | 315 +- .../_virtual_machine_scale_sets_operations.py | 417 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 399 +- .../_availability_sets_operations.py | 235 +- .../_dedicated_host_groups_operations.py | 198 +- .../operations/_dedicated_hosts_operations.py | 200 +- .../operations/_disks_operations.py | 307 +- .../operations/_galleries_operations.py | 192 +- ...gallery_application_versions_operations.py | 163 +- .../_gallery_applications_operations.py | 159 +- .../_gallery_image_versions_operations.py | 163 +- .../operations/_gallery_images_operations.py | 159 +- .../operations/_images_operations.py | 231 +- .../operations/_log_analytics_operations.py | 90 +- .../v2019_03_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 198 +- .../operations/_snapshots_operations.py | 307 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 201 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 73 +- ...machine_scale_set_extensions_operations.py | 157 +- ...e_scale_set_rolling_upgrades_operations.py | 157 +- ...irtual_machine_scale_set_vms_operations.py | 575 +- .../_virtual_machine_scale_sets_operations.py | 850 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 775 +- .../v2019_04_01/_compute_management_client.py | 12 +- .../compute/v2019_04_01/_configuration.py | 12 +- .../mgmt/compute/v2019_04_01/_metadata.json | 4 +- .../mgmt/compute/v2019_04_01/_version.py | 2 +- .../aio/_compute_management_client.py | 10 +- .../compute/v2019_04_01/aio/_configuration.py | 12 +- .../operations/_resource_skus_operations.py | 20 +- .../operations/_resource_skus_operations.py | 45 +- .../v2019_07_01/_compute_management_client.py | 14 +- .../compute/v2019_07_01/_configuration.py | 12 +- .../mgmt/compute/v2019_07_01/_metadata.json | 4 +- .../mgmt/compute/v2019_07_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2019_07_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- .../_dedicated_host_groups_operations.py | 73 +- .../operations/_dedicated_hosts_operations.py | 94 +- .../_disk_encryption_sets_operations.py | 102 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_galleries_operations.py | 102 +- ...gallery_application_versions_operations.py | 92 +- .../_gallery_applications_operations.py | 90 +- .../_gallery_image_versions_operations.py | 92 +- .../operations/_gallery_images_operations.py | 90 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2019_07_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 75 +- .../aio/operations/_snapshots_operations.py | 145 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 28 +- ...machine_scale_set_extensions_operations.py | 92 +- ...e_scale_set_rolling_upgrades_operations.py | 88 +- ...hine_scale_set_vm_extensions_operations.py | 93 +- ...irtual_machine_scale_set_vms_operations.py | 315 +- .../_virtual_machine_scale_sets_operations.py | 417 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 425 +- .../_availability_sets_operations.py | 235 +- .../_dedicated_host_groups_operations.py | 198 +- .../operations/_dedicated_hosts_operations.py | 200 +- .../_disk_encryption_sets_operations.py | 233 +- .../operations/_disks_operations.py | 307 +- .../operations/_galleries_operations.py | 233 +- ...gallery_application_versions_operations.py | 204 +- .../_gallery_applications_operations.py | 200 +- .../_gallery_image_versions_operations.py | 204 +- .../operations/_gallery_images_operations.py | 200 +- .../operations/_images_operations.py | 231 +- .../operations/_log_analytics_operations.py | 90 +- .../v2019_07_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 202 +- .../operations/_snapshots_operations.py | 307 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 201 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 73 +- ...machine_scale_set_extensions_operations.py | 198 +- ...e_scale_set_rolling_upgrades_operations.py | 157 +- ...hine_scale_set_vm_extensions_operations.py | 207 +- ...irtual_machine_scale_set_vms_operations.py | 575 +- .../_virtual_machine_scale_sets_operations.py | 850 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 824 +- .../v2019_11_01/_compute_management_client.py | 12 +- .../compute/v2019_11_01/_configuration.py | 12 +- .../mgmt/compute/v2019_11_01/_metadata.json | 4 +- .../mgmt/compute/v2019_11_01/_version.py | 2 +- .../aio/_compute_management_client.py | 10 +- .../compute/v2019_11_01/aio/_configuration.py | 12 +- .../_disk_encryption_sets_operations.py | 102 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_snapshots_operations.py | 145 +- .../_disk_encryption_sets_operations.py | 233 +- .../operations/_disks_operations.py | 307 +- .../operations/_snapshots_operations.py | 307 +- .../v2019_12_01/_compute_management_client.py | 14 +- .../compute/v2019_12_01/_configuration.py | 12 +- .../mgmt/compute/v2019_12_01/_metadata.json | 4 +- .../mgmt/compute/v2019_12_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2019_12_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- .../_dedicated_host_groups_operations.py | 73 +- .../operations/_dedicated_hosts_operations.py | 94 +- .../aio/operations/_galleries_operations.py | 102 +- ...gallery_application_versions_operations.py | 92 +- .../_gallery_applications_operations.py | 90 +- .../_gallery_image_versions_operations.py | 92 +- .../operations/_gallery_images_operations.py | 90 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2019_12_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 75 +- .../operations/_ssh_public_keys_operations.py | 84 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 28 +- ...machine_scale_set_extensions_operations.py | 92 +- ...e_scale_set_rolling_upgrades_operations.py | 88 +- ...hine_scale_set_vm_extensions_operations.py | 93 +- ...irtual_machine_scale_set_vms_operations.py | 328 +- .../_virtual_machine_scale_sets_operations.py | 440 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 438 +- .../_compute_management_client_enums.py | 1 - .../compute/v2019_12_01/models/_models_py3.py | 7 +- .../_availability_sets_operations.py | 235 +- .../_dedicated_host_groups_operations.py | 198 +- .../operations/_dedicated_hosts_operations.py | 200 +- .../operations/_galleries_operations.py | 233 +- ...gallery_application_versions_operations.py | 204 +- .../_gallery_applications_operations.py | 200 +- .../_gallery_image_versions_operations.py | 204 +- .../operations/_gallery_images_operations.py | 200 +- .../operations/_images_operations.py | 231 +- .../operations/_log_analytics_operations.py | 90 +- .../v2019_12_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 202 +- .../operations/_ssh_public_keys_operations.py | 230 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 201 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 73 +- ...machine_scale_set_extensions_operations.py | 198 +- ...e_scale_set_rolling_upgrades_operations.py | 157 +- ...hine_scale_set_vm_extensions_operations.py | 207 +- ...irtual_machine_scale_set_vms_operations.py | 603 +- .../_virtual_machine_scale_sets_operations.py | 893 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 852 +- .../v2020_05_01/_compute_management_client.py | 12 +- .../compute/v2020_05_01/_configuration.py | 12 +- .../mgmt/compute/v2020_05_01/_metadata.json | 4 +- .../mgmt/compute/v2020_05_01/_version.py | 2 +- .../aio/_compute_management_client.py | 10 +- .../compute/v2020_05_01/aio/_configuration.py | 12 +- .../operations/_disk_accesses_operations.py | 113 +- .../_disk_encryption_sets_operations.py | 102 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_snapshots_operations.py | 145 +- .../operations/_disk_accesses_operations.py | 265 +- .../_disk_encryption_sets_operations.py | 233 +- .../operations/_disks_operations.py | 307 +- .../operations/_snapshots_operations.py | 307 +- .../v2020_06_01/_compute_management_client.py | 14 +- .../compute/v2020_06_01/_configuration.py | 12 +- .../mgmt/compute/v2020_06_01/_metadata.json | 4 +- .../mgmt/compute/v2020_06_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2020_06_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- .../_dedicated_host_groups_operations.py | 77 +- .../operations/_dedicated_hosts_operations.py | 94 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2020_06_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 75 +- .../operations/_ssh_public_keys_operations.py | 84 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 135 +- ...machine_scale_set_extensions_operations.py | 92 +- ...e_scale_set_rolling_upgrades_operations.py | 88 +- ...hine_scale_set_vm_extensions_operations.py | 93 +- ...ne_scale_set_vm_run_commands_operations.py | 112 +- ...irtual_machine_scale_set_vms_operations.py | 341 +- .../_virtual_machine_scale_sets_operations.py | 440 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 474 +- .../_compute_management_client_enums.py | 1 - .../compute/v2020_06_01/models/_models_py3.py | 7 +- .../_availability_sets_operations.py | 235 +- .../_dedicated_host_groups_operations.py | 204 +- .../operations/_dedicated_hosts_operations.py | 200 +- .../operations/_images_operations.py | 231 +- .../operations/_log_analytics_operations.py | 90 +- .../v2020_06_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 202 +- .../operations/_ssh_public_keys_operations.py | 230 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 201 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 291 +- ...machine_scale_set_extensions_operations.py | 198 +- ...e_scale_set_rolling_upgrades_operations.py | 157 +- ...hine_scale_set_vm_extensions_operations.py | 207 +- ...ne_scale_set_vm_run_commands_operations.py | 226 +- ...irtual_machine_scale_set_vms_operations.py | 639 +- .../_virtual_machine_scale_sets_operations.py | 893 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 934 +- .../v2020_06_30/_compute_management_client.py | 12 +- .../compute/v2020_06_30/_configuration.py | 12 +- .../mgmt/compute/v2020_06_30/_metadata.json | 4 +- .../mgmt/compute/v2020_06_30/_version.py | 2 +- .../aio/_compute_management_client.py | 10 +- .../compute/v2020_06_30/aio/_configuration.py | 12 +- .../operations/_disk_accesses_operations.py | 113 +- .../_disk_encryption_sets_operations.py | 114 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_snapshots_operations.py | 145 +- .../operations/_disk_accesses_operations.py | 265 +- .../_disk_encryption_sets_operations.py | 266 +- .../operations/_disks_operations.py | 307 +- .../operations/_snapshots_operations.py | 307 +- .../v2020_09_30/_compute_management_client.py | 14 +- .../compute/v2020_09_30/_configuration.py | 12 +- .../mgmt/compute/v2020_09_30/_metadata.json | 4 +- .../mgmt/compute/v2020_09_30/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2020_09_30/aio/_configuration.py | 12 +- .../operations/_disk_accesses_operations.py | 179 +- .../_disk_encryption_sets_operations.py | 114 +- .../_disk_restore_point_operations.py | 28 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_galleries_operations.py | 104 +- ...gallery_application_versions_operations.py | 92 +- .../_gallery_applications_operations.py | 90 +- .../_gallery_image_versions_operations.py | 92 +- .../operations/_gallery_images_operations.py | 90 +- .../_gallery_sharing_profile_operations.py | 24 +- .../_shared_galleries_operations.py | 30 +- ...hared_gallery_image_versions_operations.py | 30 +- .../_shared_gallery_images_operations.py | 30 +- .../aio/operations/_snapshots_operations.py | 145 +- .../operations/_disk_accesses_operations.py | 416 +- .../_disk_encryption_sets_operations.py | 266 +- .../_disk_restore_point_operations.py | 73 +- .../operations/_disks_operations.py | 307 +- .../operations/_galleries_operations.py | 237 +- ...gallery_application_versions_operations.py | 204 +- .../_gallery_applications_operations.py | 200 +- .../_gallery_image_versions_operations.py | 204 +- .../operations/_gallery_images_operations.py | 200 +- .../_gallery_sharing_profile_operations.py | 49 +- .../_shared_galleries_operations.py | 77 +- ...hared_gallery_image_versions_operations.py | 77 +- .../_shared_gallery_images_operations.py | 77 +- .../operations/_snapshots_operations.py | 307 +- .../_compute_management_client.py | 12 +- .../v2020_10_01_preview/_configuration.py | 12 +- .../v2020_10_01_preview/_metadata.json | 4 +- .../compute/v2020_10_01_preview/_version.py | 2 +- .../aio/_compute_management_client.py | 10 +- .../v2020_10_01_preview/aio/_configuration.py | 12 +- ...cloud_service_role_instances_operations.py | 154 +- .../_cloud_service_roles_operations.py | 28 +- .../operations/_cloud_services_operations.py | 267 +- ...cloud_services_update_domain_operations.py | 53 +- ...cloud_service_role_instances_operations.py | 329 +- .../_cloud_service_roles_operations.py | 73 +- .../operations/_cloud_services_operations.py | 549 +- ...cloud_services_update_domain_operations.py | 120 +- .../v2020_12_01/_compute_management_client.py | 14 +- .../compute/v2020_12_01/_configuration.py | 12 +- .../mgmt/compute/v2020_12_01/_metadata.json | 4 +- .../mgmt/compute/v2020_12_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2020_12_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- .../_dedicated_host_groups_operations.py | 77 +- .../operations/_dedicated_hosts_operations.py | 94 +- .../operations/_disk_accesses_operations.py | 179 +- .../_disk_encryption_sets_operations.py | 114 +- .../_disk_restore_point_operations.py | 71 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2020_12_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 75 +- .../aio/operations/_snapshots_operations.py | 145 +- .../operations/_ssh_public_keys_operations.py | 84 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- ...ual_machine_images_edge_zone_operations.py | 65 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 135 +- ...machine_scale_set_extensions_operations.py | 92 +- ...e_scale_set_rolling_upgrades_operations.py | 88 +- ...hine_scale_set_vm_extensions_operations.py | 93 +- ...ne_scale_set_vm_run_commands_operations.py | 112 +- ...irtual_machine_scale_set_vms_operations.py | 343 +- .../_virtual_machine_scale_sets_operations.py | 455 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 493 +- .../_compute_management_client_enums.py | 1 - .../compute/v2020_12_01/models/_models_py3.py | 7 +- .../_availability_sets_operations.py | 235 +- .../_dedicated_host_groups_operations.py | 204 +- .../operations/_dedicated_hosts_operations.py | 200 +- .../operations/_disk_accesses_operations.py | 416 +- .../_disk_encryption_sets_operations.py | 266 +- .../_disk_restore_point_operations.py | 159 +- .../operations/_disks_operations.py | 307 +- .../operations/_images_operations.py | 231 +- .../operations/_log_analytics_operations.py | 90 +- .../v2020_12_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 202 +- .../operations/_snapshots_operations.py | 307 +- .../operations/_ssh_public_keys_operations.py | 230 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 201 +- ...ual_machine_images_edge_zone_operations.py | 179 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 291 +- ...machine_scale_set_extensions_operations.py | 198 +- ...e_scale_set_rolling_upgrades_operations.py | 157 +- ...hine_scale_set_vm_extensions_operations.py | 207 +- ...ne_scale_set_vm_run_commands_operations.py | 226 +- ...irtual_machine_scale_set_vms_operations.py | 643 +- .../_virtual_machine_scale_sets_operations.py | 933 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 975 +- .../v2021_03_01/_compute_management_client.py | 14 +- .../compute/v2021_03_01/_configuration.py | 12 +- .../mgmt/compute/v2021_03_01/_metadata.json | 4 +- .../mgmt/compute/v2021_03_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2021_03_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- ...ud_service_operating_systems_operations.py | 51 +- ...cloud_service_role_instances_operations.py | 150 +- .../_cloud_service_roles_operations.py | 28 +- .../operations/_cloud_services_operations.py | 267 +- ...cloud_services_update_domain_operations.py | 53 +- .../_dedicated_host_groups_operations.py | 75 +- .../operations/_dedicated_hosts_operations.py | 92 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2021_03_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 75 +- .../_restore_point_collections_operations.py | 86 +- .../operations/_restore_points_operations.py | 59 +- .../operations/_ssh_public_keys_operations.py | 84 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- ...ual_machine_images_edge_zone_operations.py | 65 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 135 +- ...machine_scale_set_extensions_operations.py | 92 +- ...e_scale_set_rolling_upgrades_operations.py | 88 +- ...hine_scale_set_vm_extensions_operations.py | 93 +- ...ne_scale_set_vm_run_commands_operations.py | 112 +- ...irtual_machine_scale_set_vms_operations.py | 341 +- .../_virtual_machine_scale_sets_operations.py | 457 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 490 +- .../_compute_management_client_enums.py | 1 - .../compute/v2021_03_01/models/_models_py3.py | 7 +- .../_availability_sets_operations.py | 235 +- ...ud_service_operating_systems_operations.py | 138 +- ...cloud_service_role_instances_operations.py | 325 +- .../_cloud_service_roles_operations.py | 73 +- .../operations/_cloud_services_operations.py | 549 +- ...cloud_services_update_domain_operations.py | 120 +- .../_dedicated_host_groups_operations.py | 202 +- .../operations/_dedicated_hosts_operations.py | 198 +- .../operations/_images_operations.py | 231 +- .../operations/_log_analytics_operations.py | 90 +- .../v2021_03_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 202 +- .../_restore_point_collections_operations.py | 219 +- .../operations/_restore_points_operations.py | 126 +- .../operations/_ssh_public_keys_operations.py | 230 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 201 +- ...ual_machine_images_edge_zone_operations.py | 179 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 291 +- ...machine_scale_set_extensions_operations.py | 198 +- ...e_scale_set_rolling_upgrades_operations.py | 157 +- ...hine_scale_set_vm_extensions_operations.py | 207 +- ...ne_scale_set_vm_run_commands_operations.py | 226 +- ...irtual_machine_scale_set_vms_operations.py | 641 +- .../_virtual_machine_scale_sets_operations.py | 937 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 972 +- .../v2021_04_01/_compute_management_client.py | 14 +- .../compute/v2021_04_01/_configuration.py | 12 +- .../mgmt/compute/v2021_04_01/_metadata.json | 4 +- .../mgmt/compute/v2021_04_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2021_04_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- ..._capacity_reservation_groups_operations.py | 79 +- .../_capacity_reservations_operations.py | 92 +- .../_dedicated_host_groups_operations.py | 75 +- .../operations/_dedicated_hosts_operations.py | 92 +- .../operations/_disk_accesses_operations.py | 179 +- .../_disk_encryption_sets_operations.py | 114 +- .../_disk_restore_point_operations.py | 71 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2021_04_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 75 +- .../_restore_point_collections_operations.py | 86 +- .../operations/_restore_points_operations.py | 59 +- .../aio/operations/_snapshots_operations.py | 145 +- .../operations/_ssh_public_keys_operations.py | 84 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- ...ual_machine_images_edge_zone_operations.py | 65 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 135 +- ...machine_scale_set_extensions_operations.py | 92 +- ...e_scale_set_rolling_upgrades_operations.py | 88 +- ...hine_scale_set_vm_extensions_operations.py | 93 +- ...ne_scale_set_vm_run_commands_operations.py | 112 +- ...irtual_machine_scale_set_vms_operations.py | 341 +- .../_virtual_machine_scale_sets_operations.py | 457 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 490 +- .../_compute_management_client_enums.py | 1 - .../compute/v2021_04_01/models/_models_py3.py | 7 +- .../_availability_sets_operations.py | 235 +- ..._capacity_reservation_groups_operations.py | 216 +- .../_capacity_reservations_operations.py | 204 +- .../_dedicated_host_groups_operations.py | 202 +- .../operations/_dedicated_hosts_operations.py | 198 +- .../operations/_disk_accesses_operations.py | 416 +- .../_disk_encryption_sets_operations.py | 266 +- .../_disk_restore_point_operations.py | 159 +- .../operations/_disks_operations.py | 307 +- .../operations/_images_operations.py | 231 +- .../operations/_log_analytics_operations.py | 90 +- .../v2021_04_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 202 +- .../_restore_point_collections_operations.py | 219 +- .../operations/_restore_points_operations.py | 126 +- .../operations/_snapshots_operations.py | 307 +- .../operations/_ssh_public_keys_operations.py | 230 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 201 +- ...ual_machine_images_edge_zone_operations.py | 179 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 291 +- ...machine_scale_set_extensions_operations.py | 198 +- ...e_scale_set_rolling_upgrades_operations.py | 157 +- ...hine_scale_set_vm_extensions_operations.py | 207 +- ...ne_scale_set_vm_run_commands_operations.py | 226 +- ...irtual_machine_scale_set_vms_operations.py | 641 +- .../_virtual_machine_scale_sets_operations.py | 937 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 972 +- .../v2021_07_01/_compute_management_client.py | 14 +- .../compute/v2021_07_01/_configuration.py | 12 +- .../mgmt/compute/v2021_07_01/_metadata.json | 4 +- .../mgmt/compute/v2021_07_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2021_07_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- ..._capacity_reservation_groups_operations.py | 79 +- .../_capacity_reservations_operations.py | 92 +- .../_community_galleries_operations.py | 16 +- ...unity_gallery_image_versions_operations.py | 16 +- .../_community_gallery_images_operations.py | 16 +- .../_dedicated_host_groups_operations.py | 75 +- .../operations/_dedicated_hosts_operations.py | 92 +- .../aio/operations/_galleries_operations.py | 104 +- ...gallery_application_versions_operations.py | 92 +- .../_gallery_applications_operations.py | 90 +- .../_gallery_image_versions_operations.py | 92 +- .../operations/_gallery_images_operations.py | 90 +- .../_gallery_sharing_profile_operations.py | 24 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2021_07_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 75 +- .../operations/_resource_skus_operations.py | 22 +- .../_restore_point_collections_operations.py | 86 +- .../operations/_restore_points_operations.py | 59 +- .../_shared_galleries_operations.py | 30 +- ...hared_gallery_image_versions_operations.py | 30 +- .../_shared_gallery_images_operations.py | 30 +- .../operations/_ssh_public_keys_operations.py | 84 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- ...ual_machine_images_edge_zone_operations.py | 65 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 135 +- ...machine_scale_set_extensions_operations.py | 92 +- ...e_scale_set_rolling_upgrades_operations.py | 88 +- ...hine_scale_set_vm_extensions_operations.py | 93 +- ...ne_scale_set_vm_run_commands_operations.py | 112 +- ...irtual_machine_scale_set_vms_operations.py | 341 +- .../_virtual_machine_scale_sets_operations.py | 457 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 491 +- .../_compute_management_client_enums.py | 1 - .../compute/v2021_07_01/models/_models_py3.py | 7 +- .../_availability_sets_operations.py | 235 +- ..._capacity_reservation_groups_operations.py | 216 +- .../_capacity_reservations_operations.py | 204 +- .../_community_galleries_operations.py | 40 +- ...unity_gallery_image_versions_operations.py | 40 +- .../_community_gallery_images_operations.py | 40 +- .../_dedicated_host_groups_operations.py | 202 +- .../operations/_dedicated_hosts_operations.py | 198 +- .../operations/_galleries_operations.py | 237 +- ...gallery_application_versions_operations.py | 204 +- .../_gallery_applications_operations.py | 200 +- .../_gallery_image_versions_operations.py | 204 +- .../operations/_gallery_images_operations.py | 200 +- .../_gallery_sharing_profile_operations.py | 49 +- .../operations/_images_operations.py | 231 +- .../operations/_log_analytics_operations.py | 90 +- .../v2021_07_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 202 +- .../operations/_resource_skus_operations.py | 49 +- .../_restore_point_collections_operations.py | 219 +- .../operations/_restore_points_operations.py | 126 +- .../_shared_galleries_operations.py | 77 +- ...hared_gallery_image_versions_operations.py | 77 +- .../_shared_gallery_images_operations.py | 77 +- .../operations/_ssh_public_keys_operations.py | 230 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 201 +- ...ual_machine_images_edge_zone_operations.py | 179 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 291 +- ...machine_scale_set_extensions_operations.py | 198 +- ...e_scale_set_rolling_upgrades_operations.py | 157 +- ...hine_scale_set_vm_extensions_operations.py | 207 +- ...ne_scale_set_vm_run_commands_operations.py | 226 +- ...irtual_machine_scale_set_vms_operations.py | 641 +- .../_virtual_machine_scale_sets_operations.py | 937 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 975 +- .../v2021_08_01/_compute_management_client.py | 12 +- .../compute/v2021_08_01/_configuration.py | 12 +- .../mgmt/compute/v2021_08_01/_metadata.json | 4 +- .../mgmt/compute/v2021_08_01/_version.py | 2 +- .../aio/_compute_management_client.py | 10 +- .../compute/v2021_08_01/aio/_configuration.py | 12 +- .../operations/_disk_accesses_operations.py | 179 +- .../_disk_encryption_sets_operations.py | 114 +- .../_disk_restore_point_operations.py | 71 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_snapshots_operations.py | 145 +- .../operations/_disk_accesses_operations.py | 416 +- .../_disk_encryption_sets_operations.py | 266 +- .../_disk_restore_point_operations.py | 159 +- .../operations/_disks_operations.py | 307 +- .../operations/_snapshots_operations.py | 307 +- .../v2021_10_01/_compute_management_client.py | 12 +- .../compute/v2021_10_01/_configuration.py | 12 +- .../mgmt/compute/v2021_10_01/_metadata.json | 4 +- .../mgmt/compute/v2021_10_01/_version.py | 2 +- .../aio/_compute_management_client.py | 10 +- .../compute/v2021_10_01/aio/_configuration.py | 12 +- .../aio/operations/_galleries_operations.py | 106 +- ...gallery_application_versions_operations.py | 92 +- .../_gallery_applications_operations.py | 90 +- .../_gallery_image_versions_operations.py | 92 +- .../operations/_gallery_images_operations.py | 90 +- .../_gallery_sharing_profile_operations.py | 24 +- .../operations/_galleries_operations.py | 241 +- ...gallery_application_versions_operations.py | 204 +- .../_gallery_applications_operations.py | 200 +- .../_gallery_image_versions_operations.py | 204 +- .../operations/_gallery_images_operations.py | 200 +- .../_gallery_sharing_profile_operations.py | 49 +- .../v2021_11_01/_compute_management_client.py | 14 +- .../compute/v2021_11_01/_configuration.py | 12 +- .../mgmt/compute/v2021_11_01/_metadata.json | 4 +- .../mgmt/compute/v2021_11_01/_version.py | 2 +- .../aio/_compute_management_client.py | 12 +- .../compute/v2021_11_01/aio/_configuration.py | 12 +- .../_availability_sets_operations.py | 87 +- ..._capacity_reservation_groups_operations.py | 79 +- .../_capacity_reservations_operations.py | 92 +- .../_dedicated_host_groups_operations.py | 75 +- .../operations/_dedicated_hosts_operations.py | 116 +- .../aio/operations/_images_operations.py | 104 +- .../operations/_log_analytics_operations.py | 43 +- .../v2021_11_01/aio/operations/_operations.py | 18 +- .../_proximity_placement_groups_operations.py | 75 +- .../_restore_point_collections_operations.py | 86 +- .../operations/_restore_points_operations.py | 61 +- .../operations/_ssh_public_keys_operations.py | 84 +- .../aio/operations/_usage_operations.py | 18 +- ...ual_machine_extension_images_operations.py | 44 +- .../_virtual_machine_extensions_operations.py | 93 +- ...ual_machine_images_edge_zone_operations.py | 65 +- .../_virtual_machine_images_operations.py | 66 +- ...virtual_machine_run_commands_operations.py | 135 +- ...machine_scale_set_extensions_operations.py | 92 +- ...e_scale_set_rolling_upgrades_operations.py | 88 +- ...hine_scale_set_vm_extensions_operations.py | 93 +- ...ne_scale_set_vm_run_commands_operations.py | 112 +- ...irtual_machine_scale_set_vms_operations.py | 341 +- .../_virtual_machine_scale_sets_operations.py | 461 +- .../_virtual_machine_sizes_operations.py | 18 +- .../_virtual_machines_operations.py | 493 +- .../_compute_management_client_enums.py | 1 - .../compute/v2021_11_01/models/_models_py3.py | 17 +- .../_availability_sets_operations.py | 241 +- ..._capacity_reservation_groups_operations.py | 216 +- .../_capacity_reservations_operations.py | 204 +- .../_dedicated_host_groups_operations.py | 208 +- .../operations/_dedicated_hosts_operations.py | 249 +- .../operations/_images_operations.py | 237 +- .../operations/_log_analytics_operations.py | 90 +- .../v2021_11_01/operations/_operations.py | 39 +- .../_proximity_placement_groups_operations.py | 208 +- .../_restore_point_collections_operations.py | 219 +- .../operations/_restore_points_operations.py | 130 +- .../operations/_ssh_public_keys_operations.py | 236 +- .../operations/_usage_operations.py | 41 +- ...ual_machine_extension_images_operations.py | 116 +- .../_virtual_machine_extensions_operations.py | 207 +- ...ual_machine_images_edge_zone_operations.py | 179 +- .../_virtual_machine_images_operations.py | 180 +- ...virtual_machine_run_commands_operations.py | 291 +- ...machine_scale_set_extensions_operations.py | 204 +- ...e_scale_set_rolling_upgrades_operations.py | 175 +- ...hine_scale_set_vm_extensions_operations.py | 207 +- ...ne_scale_set_vm_run_commands_operations.py | 226 +- ...irtual_machine_scale_set_vms_operations.py | 697 +- .../_virtual_machine_scale_sets_operations.py | 975 +- .../_virtual_machine_sizes_operations.py | 41 +- .../_virtual_machines_operations.py | 1043 +- .../v2021_12_01/_compute_management_client.py | 12 +- .../compute/v2021_12_01/_configuration.py | 12 +- .../mgmt/compute/v2021_12_01/_metadata.json | 4 +- .../mgmt/compute/v2021_12_01/_version.py | 2 +- .../aio/_compute_management_client.py | 10 +- .../compute/v2021_12_01/aio/_configuration.py | 12 +- .../operations/_disk_accesses_operations.py | 179 +- .../_disk_encryption_sets_operations.py | 114 +- .../_disk_restore_point_operations.py | 71 +- .../aio/operations/_disks_operations.py | 145 +- .../aio/operations/_snapshots_operations.py | 145 +- .../operations/_disk_accesses_operations.py | 416 +- .../_disk_encryption_sets_operations.py | 266 +- .../_disk_restore_point_operations.py | 159 +- .../operations/_disks_operations.py | 307 +- .../operations/_snapshots_operations.py | 307 +- .../mgmt/compute/v2022_03_01/__init__.py | 18 + .../v2022_03_01/_compute_management_client.py | 195 + .../compute/v2022_03_01/_configuration.py | 74 + .../mgmt/compute/v2022_03_01/_metadata.json | 127 + .../azure/mgmt/compute/v2022_03_01/_patch.py | 31 + .../azure/mgmt/compute/v2022_03_01/_vendor.py | 27 + .../mgmt/compute/v2022_03_01/_version.py | 9 + .../mgmt/compute/v2022_03_01/aio/__init__.py | 15 + .../aio/_compute_management_client.py | 194 + .../compute/v2022_03_01/aio/_configuration.py | 73 + .../mgmt/compute/v2022_03_01/aio/_patch.py | 31 + .../v2022_03_01/aio/operations/__init__.py | 63 + .../_availability_sets_operations.py | 529 + ..._capacity_reservation_groups_operations.py | 475 + .../_capacity_reservations_operations.py | 581 + .../_dedicated_host_groups_operations.py | 453 + .../operations/_dedicated_hosts_operations.py | 688 + .../aio/operations/_images_operations.py | 616 + .../operations/_log_analytics_operations.py | 288 + .../v2022_03_01/aio/operations/_operations.py | 116 + .../_proximity_placement_groups_operations.py | 448 + .../_restore_point_collections_operations.py | 506 + .../operations/_restore_points_operations.py | 353 + .../operations/_ssh_public_keys_operations.py | 505 + .../aio/operations/_usage_operations.py | 123 + ...ual_machine_extension_images_operations.py | 242 + .../_virtual_machine_extensions_operations.py | 552 + ...ual_machine_images_edge_zone_operations.py | 391 + .../_virtual_machine_images_operations.py | 367 + ...virtual_machine_run_commands_operations.py | 723 + ...machine_scale_set_extensions_operations.py | 580 + ...e_scale_set_rolling_upgrades_operations.py | 420 + ...hine_scale_set_vm_extensions_operations.py | 578 + ...ne_scale_set_vm_run_commands_operations.py | 613 + ...irtual_machine_scale_set_vms_operations.py | 1706 ++ .../_virtual_machine_scale_sets_operations.py | 2399 +++ .../_virtual_machine_sizes_operations.py | 124 + .../_virtual_machines_operations.py | 2519 +++ .../compute/v2022_03_01/models/__init__.py | 651 + .../_compute_management_client_enums.py | 802 + .../compute/v2022_03_01/models/_models_py3.py | 15511 ++++++++++++++++ .../v2022_03_01/operations/__init__.py | 63 + .../_availability_sets_operations.py | 798 + ..._capacity_reservation_groups_operations.py | 716 + .../_capacity_reservations_operations.py | 792 + .../_dedicated_host_groups_operations.py | 686 + .../operations/_dedicated_hosts_operations.py | 935 + .../operations/_images_operations.py | 847 + .../operations/_log_analytics_operations.py | 376 + .../v2022_03_01/operations/_operations.py | 145 + .../_proximity_placement_groups_operations.py | 681 + .../_restore_point_collections_operations.py | 739 + .../operations/_restore_points_operations.py | 483 + .../operations/_ssh_public_keys_operations.py | 770 + .../operations/_usage_operations.py | 159 + ...ual_machine_extension_images_operations.py | 369 + .../_virtual_machine_extensions_operations.py | 768 + ...ual_machine_images_edge_zone_operations.py | 604 + .../_virtual_machine_images_operations.py | 570 + ...virtual_machine_run_commands_operations.py | 1008 + ...machine_scale_set_extensions_operations.py | 791 + ...e_scale_set_rolling_upgrades_operations.py | 567 + ...hine_scale_set_vm_extensions_operations.py | 804 + ...ne_scale_set_vm_run_commands_operations.py | 838 + ...irtual_machine_scale_set_vms_operations.py | 2364 +++ .../_virtual_machine_scale_sets_operations.py | 3357 ++++ .../_virtual_machine_sizes_operations.py | 161 + .../_virtual_machines_operations.py | 3490 ++++ .../azure/mgmt/compute/v2022_03_01/py.typed | 1 + 1085 files changed, 153996 insertions(+), 54056 deletions(-) create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_compute_management_client.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_configuration.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_metadata.json create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_patch.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_vendor.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_version.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_compute_management_client.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_configuration.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_patch.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_availability_sets_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_capacity_reservation_groups_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_capacity_reservations_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_dedicated_host_groups_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_dedicated_hosts_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_log_analytics_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_proximity_placement_groups_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_restore_point_collections_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_restore_points_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_ssh_public_keys_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_usage_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_extension_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_run_commands_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_sets_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_sizes_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machines_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/_compute_management_client_enums.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/_models_py3.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/__init__.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_availability_sets_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_capacity_reservation_groups_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_capacity_reservations_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_dedicated_host_groups_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_dedicated_hosts_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_log_analytics_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_proximity_placement_groups_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_restore_point_collections_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_restore_points_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_ssh_public_keys_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_usage_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_extension_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_images_edge_zone_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_run_commands_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vms_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_sets_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_sizes_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machines_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/py.typed diff --git a/sdk/compute/azure-mgmt-compute/_meta.json b/sdk/compute/azure-mgmt-compute/_meta.json index e0cfed6c0a7d..bf379121a533 100644 --- a/sdk/compute/azure-mgmt-compute/_meta.json +++ b/sdk/compute/azure-mgmt-compute/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.13.0", "@autorest/modelerfour@4.19.3" ], - "commit": "0105ac02e25089e55a7d4126f8fd303f9415b115", + "commit": "8ec3b600b3b13944d078d27f919c959b763ca137", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/compute/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/compute/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/compute/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py index c704b8bf16e7..6b1c6c6406a8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py @@ -11,10 +11,11 @@ from typing import TYPE_CHECKING +from msrest import Deserializer, Serializer + from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin -from msrest import Deserializer, Serializer from ._configuration import ComputeManagementClientConfiguration @@ -55,14 +56,11 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-12-01' + DEFAULT_API_VERSION = '2022-03-01' _PROFILE_TAG = "azure.mgmt.compute.ComputeManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'availability_sets': '2021-11-01', - 'capacity_reservation_groups': '2021-11-01', - 'capacity_reservations': '2021-11-01', 'cloud_service_operating_systems': '2021-03-01', 'cloud_service_role_instances': '2021-03-01', 'cloud_service_roles': '2021-03-01', @@ -71,39 +69,21 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'community_galleries': '2021-07-01', 'community_gallery_image_versions': '2021-07-01', 'community_gallery_images': '2021-07-01', - 'dedicated_host_groups': '2021-11-01', - 'dedicated_hosts': '2021-11-01', + 'disk_accesses': '2021-12-01', + 'disk_encryption_sets': '2021-12-01', + 'disk_restore_point': '2021-12-01', + 'disks': '2021-12-01', 'galleries': '2021-10-01', 'gallery_application_versions': '2021-10-01', 'gallery_applications': '2021-10-01', 'gallery_image_versions': '2021-10-01', 'gallery_images': '2021-10-01', 'gallery_sharing_profile': '2021-10-01', - 'images': '2021-11-01', - 'log_analytics': '2021-11-01', - 'operations': '2021-11-01', - 'proximity_placement_groups': '2021-11-01', 'resource_skus': '2021-07-01', - 'restore_point_collections': '2021-11-01', - 'restore_points': '2021-11-01', 'shared_galleries': '2021-07-01', 'shared_gallery_image_versions': '2021-07-01', 'shared_gallery_images': '2021-07-01', - 'ssh_public_keys': '2021-11-01', - 'usage': '2021-11-01', - 'virtual_machine_extension_images': '2021-11-01', - 'virtual_machine_extensions': '2021-11-01', - 'virtual_machine_images': '2021-11-01', - 'virtual_machine_images_edge_zone': '2021-11-01', - 'virtual_machine_run_commands': '2021-11-01', - 'virtual_machine_scale_set_extensions': '2021-11-01', - 'virtual_machine_scale_set_rolling_upgrades': '2021-11-01', - 'virtual_machine_scale_set_vm_extensions': '2021-11-01', - 'virtual_machine_scale_set_vm_run_commands': '2021-11-01', - 'virtual_machine_scale_set_vms': '2021-11-01', - 'virtual_machine_scale_sets': '2021-11-01', - 'virtual_machine_sizes': '2021-11-01', - 'virtual_machines': '2021-11-01', + 'snapshots': '2021-12-01', }}, _PROFILE_TAG + " latest" ) @@ -160,6 +140,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-10-01: :mod:`v2021_10_01.models` * 2021-11-01: :mod:`v2021_11_01.models` * 2021-12-01: :mod:`v2021_12_01.models` + * 2022-03-01: :mod:`v2022_03_01.models` """ if api_version == '2015-06-15': from .v2015_06_15 import models @@ -245,6 +226,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-12-01': from .v2021_12_01 import models return models + elif api_version == '2022-03-01': + from .v2022_03_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -268,6 +252,7 @@ def availability_sets(self): * 2021-04-01: :class:`AvailabilitySetsOperations` * 2021-07-01: :class:`AvailabilitySetsOperations` * 2021-11-01: :class:`AvailabilitySetsOperations` + * 2022-03-01: :class:`AvailabilitySetsOperations` """ api_version = self._get_api_version('availability_sets') if api_version == '2015-06-15': @@ -304,6 +289,8 @@ def availability_sets(self): from .v2021_07_01.operations import AvailabilitySetsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import AvailabilitySetsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import AvailabilitySetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'availability_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -315,6 +302,7 @@ def capacity_reservation_groups(self): * 2021-04-01: :class:`CapacityReservationGroupsOperations` * 2021-07-01: :class:`CapacityReservationGroupsOperations` * 2021-11-01: :class:`CapacityReservationGroupsOperations` + * 2022-03-01: :class:`CapacityReservationGroupsOperations` """ api_version = self._get_api_version('capacity_reservation_groups') if api_version == '2021-04-01': @@ -323,6 +311,8 @@ def capacity_reservation_groups(self): from .v2021_07_01.operations import CapacityReservationGroupsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import CapacityReservationGroupsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import CapacityReservationGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'capacity_reservation_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -334,6 +324,7 @@ def capacity_reservations(self): * 2021-04-01: :class:`CapacityReservationsOperations` * 2021-07-01: :class:`CapacityReservationsOperations` * 2021-11-01: :class:`CapacityReservationsOperations` + * 2022-03-01: :class:`CapacityReservationsOperations` """ api_version = self._get_api_version('capacity_reservations') if api_version == '2021-04-01': @@ -342,6 +333,8 @@ def capacity_reservations(self): from .v2021_07_01.operations import CapacityReservationsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import CapacityReservationsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import CapacityReservationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'capacity_reservations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -475,6 +468,7 @@ def dedicated_host_groups(self): * 2021-04-01: :class:`DedicatedHostGroupsOperations` * 2021-07-01: :class:`DedicatedHostGroupsOperations` * 2021-11-01: :class:`DedicatedHostGroupsOperations` + * 2022-03-01: :class:`DedicatedHostGroupsOperations` """ api_version = self._get_api_version('dedicated_host_groups') if api_version == '2019-03-01': @@ -495,6 +489,8 @@ def dedicated_host_groups(self): from .v2021_07_01.operations import DedicatedHostGroupsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import DedicatedHostGroupsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import DedicatedHostGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'dedicated_host_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -512,6 +508,7 @@ def dedicated_hosts(self): * 2021-04-01: :class:`DedicatedHostsOperations` * 2021-07-01: :class:`DedicatedHostsOperations` * 2021-11-01: :class:`DedicatedHostsOperations` + * 2022-03-01: :class:`DedicatedHostsOperations` """ api_version = self._get_api_version('dedicated_hosts') if api_version == '2019-03-01': @@ -532,6 +529,8 @@ def dedicated_hosts(self): from .v2021_07_01.operations import DedicatedHostsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import DedicatedHostsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import DedicatedHostsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'dedicated_hosts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -871,6 +870,7 @@ def images(self): * 2021-04-01: :class:`ImagesOperations` * 2021-07-01: :class:`ImagesOperations` * 2021-11-01: :class:`ImagesOperations` + * 2022-03-01: :class:`ImagesOperations` """ api_version = self._get_api_version('images') if api_version == '2016-04-30-preview': @@ -903,6 +903,8 @@ def images(self): from .v2021_07_01.operations import ImagesOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import ImagesOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import ImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -924,6 +926,7 @@ def log_analytics(self): * 2021-04-01: :class:`LogAnalyticsOperations` * 2021-07-01: :class:`LogAnalyticsOperations` * 2021-11-01: :class:`LogAnalyticsOperations` + * 2022-03-01: :class:`LogAnalyticsOperations` """ api_version = self._get_api_version('log_analytics') if api_version == '2017-12-01': @@ -952,6 +955,8 @@ def log_analytics(self): from .v2021_07_01.operations import LogAnalyticsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import LogAnalyticsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import LogAnalyticsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'log_analytics'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -973,6 +978,7 @@ def operations(self): * 2021-04-01: :class:`Operations` * 2021-07-01: :class:`Operations` * 2021-11-01: :class:`Operations` + * 2022-03-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-12-01': @@ -1001,6 +1007,8 @@ def operations(self): from .v2021_07_01.operations import Operations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import Operations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1021,6 +1029,7 @@ def proximity_placement_groups(self): * 2021-04-01: :class:`ProximityPlacementGroupsOperations` * 2021-07-01: :class:`ProximityPlacementGroupsOperations` * 2021-11-01: :class:`ProximityPlacementGroupsOperations` + * 2022-03-01: :class:`ProximityPlacementGroupsOperations` """ api_version = self._get_api_version('proximity_placement_groups') if api_version == '2018-04-01': @@ -1047,6 +1056,8 @@ def proximity_placement_groups(self): from .v2021_07_01.operations import ProximityPlacementGroupsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import ProximityPlacementGroupsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import ProximityPlacementGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'proximity_placement_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1081,6 +1092,7 @@ def restore_point_collections(self): * 2021-04-01: :class:`RestorePointCollectionsOperations` * 2021-07-01: :class:`RestorePointCollectionsOperations` * 2021-11-01: :class:`RestorePointCollectionsOperations` + * 2022-03-01: :class:`RestorePointCollectionsOperations` """ api_version = self._get_api_version('restore_point_collections') if api_version == '2021-03-01': @@ -1091,6 +1103,8 @@ def restore_point_collections(self): from .v2021_07_01.operations import RestorePointCollectionsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import RestorePointCollectionsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import RestorePointCollectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'restore_point_collections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1103,6 +1117,7 @@ def restore_points(self): * 2021-04-01: :class:`RestorePointsOperations` * 2021-07-01: :class:`RestorePointsOperations` * 2021-11-01: :class:`RestorePointsOperations` + * 2022-03-01: :class:`RestorePointsOperations` """ api_version = self._get_api_version('restore_points') if api_version == '2021-03-01': @@ -1113,6 +1128,8 @@ def restore_points(self): from .v2021_07_01.operations import RestorePointsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import RestorePointsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import RestorePointsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'restore_points'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1231,6 +1248,7 @@ def ssh_public_keys(self): * 2021-04-01: :class:`SshPublicKeysOperations` * 2021-07-01: :class:`SshPublicKeysOperations` * 2021-11-01: :class:`SshPublicKeysOperations` + * 2022-03-01: :class:`SshPublicKeysOperations` """ api_version = self._get_api_version('ssh_public_keys') if api_version == '2019-12-01': @@ -1247,6 +1265,8 @@ def ssh_public_keys(self): from .v2021_07_01.operations import SshPublicKeysOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import SshPublicKeysOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import SshPublicKeysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'ssh_public_keys'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1272,6 +1292,7 @@ def usage(self): * 2021-04-01: :class:`UsageOperations` * 2021-07-01: :class:`UsageOperations` * 2021-11-01: :class:`UsageOperations` + * 2022-03-01: :class:`UsageOperations` """ api_version = self._get_api_version('usage') if api_version == '2015-06-15': @@ -1308,6 +1329,8 @@ def usage(self): from .v2021_07_01.operations import UsageOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import UsageOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import UsageOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'usage'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1333,6 +1356,7 @@ def virtual_machine_extension_images(self): * 2021-04-01: :class:`VirtualMachineExtensionImagesOperations` * 2021-07-01: :class:`VirtualMachineExtensionImagesOperations` * 2021-11-01: :class:`VirtualMachineExtensionImagesOperations` + * 2022-03-01: :class:`VirtualMachineExtensionImagesOperations` """ api_version = self._get_api_version('virtual_machine_extension_images') if api_version == '2015-06-15': @@ -1369,6 +1393,8 @@ def virtual_machine_extension_images(self): from .v2021_07_01.operations import VirtualMachineExtensionImagesOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineExtensionImagesOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineExtensionImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_extension_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1394,6 +1420,7 @@ def virtual_machine_extensions(self): * 2021-04-01: :class:`VirtualMachineExtensionsOperations` * 2021-07-01: :class:`VirtualMachineExtensionsOperations` * 2021-11-01: :class:`VirtualMachineExtensionsOperations` + * 2022-03-01: :class:`VirtualMachineExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_extensions') if api_version == '2015-06-15': @@ -1430,6 +1457,8 @@ def virtual_machine_extensions(self): from .v2021_07_01.operations import VirtualMachineExtensionsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineExtensionsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1455,6 +1484,7 @@ def virtual_machine_images(self): * 2021-04-01: :class:`VirtualMachineImagesOperations` * 2021-07-01: :class:`VirtualMachineImagesOperations` * 2021-11-01: :class:`VirtualMachineImagesOperations` + * 2022-03-01: :class:`VirtualMachineImagesOperations` """ api_version = self._get_api_version('virtual_machine_images') if api_version == '2015-06-15': @@ -1491,6 +1521,8 @@ def virtual_machine_images(self): from .v2021_07_01.operations import VirtualMachineImagesOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineImagesOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1504,6 +1536,7 @@ def virtual_machine_images_edge_zone(self): * 2021-04-01: :class:`VirtualMachineImagesEdgeZoneOperations` * 2021-07-01: :class:`VirtualMachineImagesEdgeZoneOperations` * 2021-11-01: :class:`VirtualMachineImagesEdgeZoneOperations` + * 2022-03-01: :class:`VirtualMachineImagesEdgeZoneOperations` """ api_version = self._get_api_version('virtual_machine_images_edge_zone') if api_version == '2020-12-01': @@ -1516,6 +1549,8 @@ def virtual_machine_images_edge_zone(self): from .v2021_07_01.operations import VirtualMachineImagesEdgeZoneOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineImagesEdgeZoneOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineImagesEdgeZoneOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_images_edge_zone'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1538,6 +1573,7 @@ def virtual_machine_run_commands(self): * 2021-04-01: :class:`VirtualMachineRunCommandsOperations` * 2021-07-01: :class:`VirtualMachineRunCommandsOperations` * 2021-11-01: :class:`VirtualMachineRunCommandsOperations` + * 2022-03-01: :class:`VirtualMachineRunCommandsOperations` """ api_version = self._get_api_version('virtual_machine_run_commands') if api_version == '2017-03-30': @@ -1568,6 +1604,8 @@ def virtual_machine_run_commands(self): from .v2021_07_01.operations import VirtualMachineRunCommandsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineRunCommandsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineRunCommandsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_run_commands'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1590,6 +1628,7 @@ def virtual_machine_scale_set_extensions(self): * 2021-04-01: :class:`VirtualMachineScaleSetExtensionsOperations` * 2021-07-01: :class:`VirtualMachineScaleSetExtensionsOperations` * 2021-11-01: :class:`VirtualMachineScaleSetExtensionsOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_extensions') if api_version == '2017-03-30': @@ -1620,6 +1659,8 @@ def virtual_machine_scale_set_extensions(self): from .v2021_07_01.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1642,6 +1683,7 @@ def virtual_machine_scale_set_rolling_upgrades(self): * 2021-04-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` * 2021-07-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` * 2021-11-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_rolling_upgrades') if api_version == '2017-03-30': @@ -1672,6 +1714,8 @@ def virtual_machine_scale_set_rolling_upgrades(self): from .v2021_07_01.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_rolling_upgrades'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1688,6 +1732,7 @@ def virtual_machine_scale_set_vm_extensions(self): * 2021-04-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` * 2021-07-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` * 2021-11-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vm_extensions') if api_version == '2019-07-01': @@ -1706,6 +1751,8 @@ def virtual_machine_scale_set_vm_extensions(self): from .v2021_07_01.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vm_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1720,6 +1767,7 @@ def virtual_machine_scale_set_vm_run_commands(self): * 2021-04-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` * 2021-07-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` * 2021-11-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vm_run_commands') if api_version == '2020-06-01': @@ -1734,6 +1782,8 @@ def virtual_machine_scale_set_vm_run_commands(self): from .v2021_07_01.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vm_run_commands'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1759,6 +1809,7 @@ def virtual_machine_scale_set_vms(self): * 2021-04-01: :class:`VirtualMachineScaleSetVMsOperations` * 2021-07-01: :class:`VirtualMachineScaleSetVMsOperations` * 2021-11-01: :class:`VirtualMachineScaleSetVMsOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetVMsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vms') if api_version == '2015-06-15': @@ -1795,6 +1846,8 @@ def virtual_machine_scale_set_vms(self): from .v2021_07_01.operations import VirtualMachineScaleSetVMsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineScaleSetVMsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineScaleSetVMsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vms'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1820,6 +1873,7 @@ def virtual_machine_scale_sets(self): * 2021-04-01: :class:`VirtualMachineScaleSetsOperations` * 2021-07-01: :class:`VirtualMachineScaleSetsOperations` * 2021-11-01: :class:`VirtualMachineScaleSetsOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetsOperations` """ api_version = self._get_api_version('virtual_machine_scale_sets') if api_version == '2015-06-15': @@ -1856,6 +1910,8 @@ def virtual_machine_scale_sets(self): from .v2021_07_01.operations import VirtualMachineScaleSetsOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineScaleSetsOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineScaleSetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1881,6 +1937,7 @@ def virtual_machine_sizes(self): * 2021-04-01: :class:`VirtualMachineSizesOperations` * 2021-07-01: :class:`VirtualMachineSizesOperations` * 2021-11-01: :class:`VirtualMachineSizesOperations` + * 2022-03-01: :class:`VirtualMachineSizesOperations` """ api_version = self._get_api_version('virtual_machine_sizes') if api_version == '2015-06-15': @@ -1917,6 +1974,8 @@ def virtual_machine_sizes(self): from .v2021_07_01.operations import VirtualMachineSizesOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachineSizesOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachineSizesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_sizes'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1942,6 +2001,7 @@ def virtual_machines(self): * 2021-04-01: :class:`VirtualMachinesOperations` * 2021-07-01: :class:`VirtualMachinesOperations` * 2021-11-01: :class:`VirtualMachinesOperations` + * 2022-03-01: :class:`VirtualMachinesOperations` """ api_version = self._get_api_version('virtual_machines') if api_version == '2015-06-15': @@ -1978,6 +2038,8 @@ def virtual_machines(self): from .v2021_07_01.operations import VirtualMachinesOperations as OperationClass elif api_version == '2021-11-01': from .v2021_11_01.operations import VirtualMachinesOperations as OperationClass + elif api_version == '2022-03-01': + from .v2022_03_01.operations import VirtualMachinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py index 042e5c61067d..0cf0cca01b5d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py @@ -11,10 +11,11 @@ from typing import Any, Optional, TYPE_CHECKING +from msrest import Deserializer, Serializer + from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin -from msrest import Deserializer, Serializer from ._configuration import ComputeManagementClientConfiguration @@ -54,14 +55,11 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-12-01' + DEFAULT_API_VERSION = '2022-03-01' _PROFILE_TAG = "azure.mgmt.compute.ComputeManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'availability_sets': '2021-11-01', - 'capacity_reservation_groups': '2021-11-01', - 'capacity_reservations': '2021-11-01', 'cloud_service_operating_systems': '2021-03-01', 'cloud_service_role_instances': '2021-03-01', 'cloud_service_roles': '2021-03-01', @@ -70,39 +68,21 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'community_galleries': '2021-07-01', 'community_gallery_image_versions': '2021-07-01', 'community_gallery_images': '2021-07-01', - 'dedicated_host_groups': '2021-11-01', - 'dedicated_hosts': '2021-11-01', + 'disk_accesses': '2021-12-01', + 'disk_encryption_sets': '2021-12-01', + 'disk_restore_point': '2021-12-01', + 'disks': '2021-12-01', 'galleries': '2021-10-01', 'gallery_application_versions': '2021-10-01', 'gallery_applications': '2021-10-01', 'gallery_image_versions': '2021-10-01', 'gallery_images': '2021-10-01', 'gallery_sharing_profile': '2021-10-01', - 'images': '2021-11-01', - 'log_analytics': '2021-11-01', - 'operations': '2021-11-01', - 'proximity_placement_groups': '2021-11-01', 'resource_skus': '2021-07-01', - 'restore_point_collections': '2021-11-01', - 'restore_points': '2021-11-01', 'shared_galleries': '2021-07-01', 'shared_gallery_image_versions': '2021-07-01', 'shared_gallery_images': '2021-07-01', - 'ssh_public_keys': '2021-11-01', - 'usage': '2021-11-01', - 'virtual_machine_extension_images': '2021-11-01', - 'virtual_machine_extensions': '2021-11-01', - 'virtual_machine_images': '2021-11-01', - 'virtual_machine_images_edge_zone': '2021-11-01', - 'virtual_machine_run_commands': '2021-11-01', - 'virtual_machine_scale_set_extensions': '2021-11-01', - 'virtual_machine_scale_set_rolling_upgrades': '2021-11-01', - 'virtual_machine_scale_set_vm_extensions': '2021-11-01', - 'virtual_machine_scale_set_vm_run_commands': '2021-11-01', - 'virtual_machine_scale_set_vms': '2021-11-01', - 'virtual_machine_scale_sets': '2021-11-01', - 'virtual_machine_sizes': '2021-11-01', - 'virtual_machines': '2021-11-01', + 'snapshots': '2021-12-01', }}, _PROFILE_TAG + " latest" ) @@ -159,6 +139,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-10-01: :mod:`v2021_10_01.models` * 2021-11-01: :mod:`v2021_11_01.models` * 2021-12-01: :mod:`v2021_12_01.models` + * 2022-03-01: :mod:`v2022_03_01.models` """ if api_version == '2015-06-15': from ..v2015_06_15 import models @@ -244,6 +225,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-12-01': from ..v2021_12_01 import models return models + elif api_version == '2022-03-01': + from ..v2022_03_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -267,6 +251,7 @@ def availability_sets(self): * 2021-04-01: :class:`AvailabilitySetsOperations` * 2021-07-01: :class:`AvailabilitySetsOperations` * 2021-11-01: :class:`AvailabilitySetsOperations` + * 2022-03-01: :class:`AvailabilitySetsOperations` """ api_version = self._get_api_version('availability_sets') if api_version == '2015-06-15': @@ -303,6 +288,8 @@ def availability_sets(self): from ..v2021_07_01.aio.operations import AvailabilitySetsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import AvailabilitySetsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import AvailabilitySetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'availability_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -314,6 +301,7 @@ def capacity_reservation_groups(self): * 2021-04-01: :class:`CapacityReservationGroupsOperations` * 2021-07-01: :class:`CapacityReservationGroupsOperations` * 2021-11-01: :class:`CapacityReservationGroupsOperations` + * 2022-03-01: :class:`CapacityReservationGroupsOperations` """ api_version = self._get_api_version('capacity_reservation_groups') if api_version == '2021-04-01': @@ -322,6 +310,8 @@ def capacity_reservation_groups(self): from ..v2021_07_01.aio.operations import CapacityReservationGroupsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import CapacityReservationGroupsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import CapacityReservationGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'capacity_reservation_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -333,6 +323,7 @@ def capacity_reservations(self): * 2021-04-01: :class:`CapacityReservationsOperations` * 2021-07-01: :class:`CapacityReservationsOperations` * 2021-11-01: :class:`CapacityReservationsOperations` + * 2022-03-01: :class:`CapacityReservationsOperations` """ api_version = self._get_api_version('capacity_reservations') if api_version == '2021-04-01': @@ -341,6 +332,8 @@ def capacity_reservations(self): from ..v2021_07_01.aio.operations import CapacityReservationsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import CapacityReservationsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import CapacityReservationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'capacity_reservations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -474,6 +467,7 @@ def dedicated_host_groups(self): * 2021-04-01: :class:`DedicatedHostGroupsOperations` * 2021-07-01: :class:`DedicatedHostGroupsOperations` * 2021-11-01: :class:`DedicatedHostGroupsOperations` + * 2022-03-01: :class:`DedicatedHostGroupsOperations` """ api_version = self._get_api_version('dedicated_host_groups') if api_version == '2019-03-01': @@ -494,6 +488,8 @@ def dedicated_host_groups(self): from ..v2021_07_01.aio.operations import DedicatedHostGroupsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import DedicatedHostGroupsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import DedicatedHostGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'dedicated_host_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -511,6 +507,7 @@ def dedicated_hosts(self): * 2021-04-01: :class:`DedicatedHostsOperations` * 2021-07-01: :class:`DedicatedHostsOperations` * 2021-11-01: :class:`DedicatedHostsOperations` + * 2022-03-01: :class:`DedicatedHostsOperations` """ api_version = self._get_api_version('dedicated_hosts') if api_version == '2019-03-01': @@ -531,6 +528,8 @@ def dedicated_hosts(self): from ..v2021_07_01.aio.operations import DedicatedHostsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import DedicatedHostsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import DedicatedHostsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'dedicated_hosts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -870,6 +869,7 @@ def images(self): * 2021-04-01: :class:`ImagesOperations` * 2021-07-01: :class:`ImagesOperations` * 2021-11-01: :class:`ImagesOperations` + * 2022-03-01: :class:`ImagesOperations` """ api_version = self._get_api_version('images') if api_version == '2016-04-30-preview': @@ -902,6 +902,8 @@ def images(self): from ..v2021_07_01.aio.operations import ImagesOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import ImagesOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import ImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -923,6 +925,7 @@ def log_analytics(self): * 2021-04-01: :class:`LogAnalyticsOperations` * 2021-07-01: :class:`LogAnalyticsOperations` * 2021-11-01: :class:`LogAnalyticsOperations` + * 2022-03-01: :class:`LogAnalyticsOperations` """ api_version = self._get_api_version('log_analytics') if api_version == '2017-12-01': @@ -951,6 +954,8 @@ def log_analytics(self): from ..v2021_07_01.aio.operations import LogAnalyticsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import LogAnalyticsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import LogAnalyticsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'log_analytics'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -972,6 +977,7 @@ def operations(self): * 2021-04-01: :class:`Operations` * 2021-07-01: :class:`Operations` * 2021-11-01: :class:`Operations` + * 2022-03-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-12-01': @@ -1000,6 +1006,8 @@ def operations(self): from ..v2021_07_01.aio.operations import Operations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import Operations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1020,6 +1028,7 @@ def proximity_placement_groups(self): * 2021-04-01: :class:`ProximityPlacementGroupsOperations` * 2021-07-01: :class:`ProximityPlacementGroupsOperations` * 2021-11-01: :class:`ProximityPlacementGroupsOperations` + * 2022-03-01: :class:`ProximityPlacementGroupsOperations` """ api_version = self._get_api_version('proximity_placement_groups') if api_version == '2018-04-01': @@ -1046,6 +1055,8 @@ def proximity_placement_groups(self): from ..v2021_07_01.aio.operations import ProximityPlacementGroupsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import ProximityPlacementGroupsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import ProximityPlacementGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'proximity_placement_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1080,6 +1091,7 @@ def restore_point_collections(self): * 2021-04-01: :class:`RestorePointCollectionsOperations` * 2021-07-01: :class:`RestorePointCollectionsOperations` * 2021-11-01: :class:`RestorePointCollectionsOperations` + * 2022-03-01: :class:`RestorePointCollectionsOperations` """ api_version = self._get_api_version('restore_point_collections') if api_version == '2021-03-01': @@ -1090,6 +1102,8 @@ def restore_point_collections(self): from ..v2021_07_01.aio.operations import RestorePointCollectionsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import RestorePointCollectionsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import RestorePointCollectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'restore_point_collections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1102,6 +1116,7 @@ def restore_points(self): * 2021-04-01: :class:`RestorePointsOperations` * 2021-07-01: :class:`RestorePointsOperations` * 2021-11-01: :class:`RestorePointsOperations` + * 2022-03-01: :class:`RestorePointsOperations` """ api_version = self._get_api_version('restore_points') if api_version == '2021-03-01': @@ -1112,6 +1127,8 @@ def restore_points(self): from ..v2021_07_01.aio.operations import RestorePointsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import RestorePointsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import RestorePointsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'restore_points'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1230,6 +1247,7 @@ def ssh_public_keys(self): * 2021-04-01: :class:`SshPublicKeysOperations` * 2021-07-01: :class:`SshPublicKeysOperations` * 2021-11-01: :class:`SshPublicKeysOperations` + * 2022-03-01: :class:`SshPublicKeysOperations` """ api_version = self._get_api_version('ssh_public_keys') if api_version == '2019-12-01': @@ -1246,6 +1264,8 @@ def ssh_public_keys(self): from ..v2021_07_01.aio.operations import SshPublicKeysOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import SshPublicKeysOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import SshPublicKeysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'ssh_public_keys'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1271,6 +1291,7 @@ def usage(self): * 2021-04-01: :class:`UsageOperations` * 2021-07-01: :class:`UsageOperations` * 2021-11-01: :class:`UsageOperations` + * 2022-03-01: :class:`UsageOperations` """ api_version = self._get_api_version('usage') if api_version == '2015-06-15': @@ -1307,6 +1328,8 @@ def usage(self): from ..v2021_07_01.aio.operations import UsageOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import UsageOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import UsageOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'usage'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1332,6 +1355,7 @@ def virtual_machine_extension_images(self): * 2021-04-01: :class:`VirtualMachineExtensionImagesOperations` * 2021-07-01: :class:`VirtualMachineExtensionImagesOperations` * 2021-11-01: :class:`VirtualMachineExtensionImagesOperations` + * 2022-03-01: :class:`VirtualMachineExtensionImagesOperations` """ api_version = self._get_api_version('virtual_machine_extension_images') if api_version == '2015-06-15': @@ -1368,6 +1392,8 @@ def virtual_machine_extension_images(self): from ..v2021_07_01.aio.operations import VirtualMachineExtensionImagesOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineExtensionImagesOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineExtensionImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_extension_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1393,6 +1419,7 @@ def virtual_machine_extensions(self): * 2021-04-01: :class:`VirtualMachineExtensionsOperations` * 2021-07-01: :class:`VirtualMachineExtensionsOperations` * 2021-11-01: :class:`VirtualMachineExtensionsOperations` + * 2022-03-01: :class:`VirtualMachineExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_extensions') if api_version == '2015-06-15': @@ -1429,6 +1456,8 @@ def virtual_machine_extensions(self): from ..v2021_07_01.aio.operations import VirtualMachineExtensionsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineExtensionsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1454,6 +1483,7 @@ def virtual_machine_images(self): * 2021-04-01: :class:`VirtualMachineImagesOperations` * 2021-07-01: :class:`VirtualMachineImagesOperations` * 2021-11-01: :class:`VirtualMachineImagesOperations` + * 2022-03-01: :class:`VirtualMachineImagesOperations` """ api_version = self._get_api_version('virtual_machine_images') if api_version == '2015-06-15': @@ -1490,6 +1520,8 @@ def virtual_machine_images(self): from ..v2021_07_01.aio.operations import VirtualMachineImagesOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineImagesOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1503,6 +1535,7 @@ def virtual_machine_images_edge_zone(self): * 2021-04-01: :class:`VirtualMachineImagesEdgeZoneOperations` * 2021-07-01: :class:`VirtualMachineImagesEdgeZoneOperations` * 2021-11-01: :class:`VirtualMachineImagesEdgeZoneOperations` + * 2022-03-01: :class:`VirtualMachineImagesEdgeZoneOperations` """ api_version = self._get_api_version('virtual_machine_images_edge_zone') if api_version == '2020-12-01': @@ -1515,6 +1548,8 @@ def virtual_machine_images_edge_zone(self): from ..v2021_07_01.aio.operations import VirtualMachineImagesEdgeZoneOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineImagesEdgeZoneOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineImagesEdgeZoneOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_images_edge_zone'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1537,6 +1572,7 @@ def virtual_machine_run_commands(self): * 2021-04-01: :class:`VirtualMachineRunCommandsOperations` * 2021-07-01: :class:`VirtualMachineRunCommandsOperations` * 2021-11-01: :class:`VirtualMachineRunCommandsOperations` + * 2022-03-01: :class:`VirtualMachineRunCommandsOperations` """ api_version = self._get_api_version('virtual_machine_run_commands') if api_version == '2017-03-30': @@ -1567,6 +1603,8 @@ def virtual_machine_run_commands(self): from ..v2021_07_01.aio.operations import VirtualMachineRunCommandsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineRunCommandsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineRunCommandsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_run_commands'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1589,6 +1627,7 @@ def virtual_machine_scale_set_extensions(self): * 2021-04-01: :class:`VirtualMachineScaleSetExtensionsOperations` * 2021-07-01: :class:`VirtualMachineScaleSetExtensionsOperations` * 2021-11-01: :class:`VirtualMachineScaleSetExtensionsOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_extensions') if api_version == '2017-03-30': @@ -1619,6 +1658,8 @@ def virtual_machine_scale_set_extensions(self): from ..v2021_07_01.aio.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1641,6 +1682,7 @@ def virtual_machine_scale_set_rolling_upgrades(self): * 2021-04-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` * 2021-07-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` * 2021-11-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_rolling_upgrades') if api_version == '2017-03-30': @@ -1671,6 +1713,8 @@ def virtual_machine_scale_set_rolling_upgrades(self): from ..v2021_07_01.aio.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_rolling_upgrades'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1687,6 +1731,7 @@ def virtual_machine_scale_set_vm_extensions(self): * 2021-04-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` * 2021-07-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` * 2021-11-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vm_extensions') if api_version == '2019-07-01': @@ -1705,6 +1750,8 @@ def virtual_machine_scale_set_vm_extensions(self): from ..v2021_07_01.aio.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vm_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1719,6 +1766,7 @@ def virtual_machine_scale_set_vm_run_commands(self): * 2021-04-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` * 2021-07-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` * 2021-11-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vm_run_commands') if api_version == '2020-06-01': @@ -1733,6 +1781,8 @@ def virtual_machine_scale_set_vm_run_commands(self): from ..v2021_07_01.aio.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vm_run_commands'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1758,6 +1808,7 @@ def virtual_machine_scale_set_vms(self): * 2021-04-01: :class:`VirtualMachineScaleSetVMsOperations` * 2021-07-01: :class:`VirtualMachineScaleSetVMsOperations` * 2021-11-01: :class:`VirtualMachineScaleSetVMsOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetVMsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vms') if api_version == '2015-06-15': @@ -1794,6 +1845,8 @@ def virtual_machine_scale_set_vms(self): from ..v2021_07_01.aio.operations import VirtualMachineScaleSetVMsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineScaleSetVMsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineScaleSetVMsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vms'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1819,6 +1872,7 @@ def virtual_machine_scale_sets(self): * 2021-04-01: :class:`VirtualMachineScaleSetsOperations` * 2021-07-01: :class:`VirtualMachineScaleSetsOperations` * 2021-11-01: :class:`VirtualMachineScaleSetsOperations` + * 2022-03-01: :class:`VirtualMachineScaleSetsOperations` """ api_version = self._get_api_version('virtual_machine_scale_sets') if api_version == '2015-06-15': @@ -1855,6 +1909,8 @@ def virtual_machine_scale_sets(self): from ..v2021_07_01.aio.operations import VirtualMachineScaleSetsOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineScaleSetsOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineScaleSetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1880,6 +1936,7 @@ def virtual_machine_sizes(self): * 2021-04-01: :class:`VirtualMachineSizesOperations` * 2021-07-01: :class:`VirtualMachineSizesOperations` * 2021-11-01: :class:`VirtualMachineSizesOperations` + * 2022-03-01: :class:`VirtualMachineSizesOperations` """ api_version = self._get_api_version('virtual_machine_sizes') if api_version == '2015-06-15': @@ -1916,6 +1973,8 @@ def virtual_machine_sizes(self): from ..v2021_07_01.aio.operations import VirtualMachineSizesOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachineSizesOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachineSizesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_sizes'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1941,6 +2000,7 @@ def virtual_machines(self): * 2021-04-01: :class:`VirtualMachinesOperations` * 2021-07-01: :class:`VirtualMachinesOperations` * 2021-11-01: :class:`VirtualMachinesOperations` + * 2022-03-01: :class:`VirtualMachinesOperations` """ api_version = self._get_api_version('virtual_machines') if api_version == '2015-06-15': @@ -1977,6 +2037,8 @@ def virtual_machines(self): from ..v2021_07_01.aio.operations import VirtualMachinesOperations as OperationClass elif api_version == '2021-11-01': from ..v2021_11_01.aio.operations import VirtualMachinesOperations as OperationClass + elif api_version == '2022-03-01': + from ..v2022_03_01.aio.operations import VirtualMachinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py index a77d6b519e97..fe9149f7c5ad 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/models.py @@ -7,5 +7,5 @@ from .v2021_03_01.models import * from .v2021_07_01.models import * from .v2021_10_01.models import * -from .v2021_11_01.models import * from .v2021_12_01.models import * +from .v2022_03_01.models import * diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_compute_management_client.py index bb142e56ede8..ebdc84b1e892 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations @@ -54,8 +55,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2015-06-15". 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. """ @@ -87,7 +91,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_configuration.py index 59395683c7dc..d964bce0cab4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2015-06-15". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2015-06-15" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_metadata.json index 438225d6d456..2cb8a4bba631 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_compute_management_client.py index dd6073a05b45..7d972ff78908 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations @@ -55,8 +56,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2015-06-15". 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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_configuration.py index 784470dc29b8..5f192fc7bbcb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/_configuration.py @@ -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 "2015-06-15". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2015-06-15" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_availability_sets_operations.py index fe6a7d46bb21..bea5a0fca315 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( resource_group_name=resource_group_name, name=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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -129,17 +134,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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) - 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]: @@ -155,7 +167,7 @@ async def delete( return deserialized - 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 @@ -182,17 +194,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: 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) - 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]: @@ -206,7 +225,7 @@ async def get( 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 @@ -226,6 +245,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -237,6 +258,7 @@ def prepare_request(next_link=None): 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) @@ -247,6 +269,7 @@ def prepare_request(next_link=None): 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) @@ -264,7 +287,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]: @@ -277,7 +304,7 @@ async def get_next(next_link=None): 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( @@ -300,6 +327,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -312,6 +341,7 @@ def prepare_request(next_link=None): 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) @@ -323,6 +353,7 @@ def prepare_request(next_link=None): 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) @@ -340,7 +371,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]: @@ -353,4 +388,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_usage_operations.py index 163a74f3f130..e50c0ffe434c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extension_images_operations.py index ad30e0cca964..2772ef79c79e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extensions_operations.py index 53307b1d861d..aa913b20b922 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,10 +309,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _delete_initial( self, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -340,7 +360,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -373,7 +393,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,6 +406,7 @@ 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 ) @@ -408,10 +430,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -430,7 +451,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) @@ -443,19 +464,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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) - 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]: @@ -469,5 +497,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_images_operations.py index 840ddf679186..6cae40a833b0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_set_vms_operations.py index 68a15a3bc1dd..58a453e70708 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,18 +60,25 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -88,7 +94,7 @@ async def _reimage_initial( return deserialized - _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 @distributed_trace_async @@ -121,7 +127,8 @@ async def begin_reimage( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -133,6 +140,7 @@ async def begin_reimage( 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 ) @@ -156,10 +164,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore async def _deallocate_initial( self, @@ -174,18 +181,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -201,7 +215,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -236,7 +250,8 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -248,6 +263,7 @@ 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 ) @@ -271,10 +287,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _delete_initial( self, @@ -289,18 +304,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -316,7 +338,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -349,7 +371,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -361,6 +384,7 @@ async def begin_delete( 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 ) @@ -384,10 +408,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -416,18 +439,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -441,7 +471,7 @@ async def get( 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 @@ -471,18 +501,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: 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) - 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 +533,7 @@ async def get_instance_view( 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 @@ -517,12 +554,13 @@ 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 @@ -531,6 +569,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -543,6 +583,7 @@ def prepare_request(next_link=None): 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, @@ -557,6 +598,7 @@ def prepare_request(next_link=None): 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, @@ -577,7 +619,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]: @@ -590,7 +636,7 @@ async def get_next(next_link=None): 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( self, @@ -605,18 +651,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -632,7 +685,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -667,7 +720,8 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -679,6 +733,7 @@ async def begin_power_off( 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 ) @@ -702,10 +757,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore async def _restart_initial( self, @@ -720,18 +774,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -747,7 +808,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -780,7 +841,8 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -792,6 +854,7 @@ 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 ) @@ -815,10 +878,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore async def _start_initial( self, @@ -833,18 +895,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -860,7 +929,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -893,7 +962,8 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -905,6 +975,7 @@ 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 ) @@ -928,7 +999,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_sets_operations.py index 09cfc16f4a40..0c7ac15126e3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, name=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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _delete_initial( self, @@ -181,17 +187,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -207,7 +220,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -237,7 +250,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -248,6 +262,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -271,10 +286,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -300,17 +314,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -324,7 +345,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _deallocate_initial( @@ -340,6 +361,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -351,6 +373,7 @@ async def _deallocate_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'], @@ -358,7 +381,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -374,7 +401,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -393,7 +420,8 @@ 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. + :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -410,8 +438,9 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -423,6 +452,7 @@ 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 @@ -447,10 +477,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore async def _delete_instances_initial( self, @@ -465,6 +494,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -473,6 +503,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -480,7 +511,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -496,7 +531,7 @@ async def _delete_instances_initial( return deserialized - _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 @distributed_trace_async @@ -530,8 +565,9 @@ async def begin_delete_instances( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -543,6 +579,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -567,10 +604,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) + 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 + 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( @@ -596,17 +632,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: 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) - 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]: @@ -620,7 +663,7 @@ async def get_instance_view( 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 @@ -640,6 +683,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -651,6 +696,7 @@ def prepare_request(next_link=None): 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) @@ -661,6 +707,7 @@ def prepare_request(next_link=None): 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) @@ -678,7 +725,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]: @@ -691,7 +742,7 @@ async def get_next(next_link=None): 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( @@ -709,6 +760,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -719,6 +772,7 @@ def prepare_request(next_link=None): 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) @@ -728,6 +782,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -745,7 +800,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]: @@ -758,7 +817,7 @@ async def get_next(next_link=None): 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( @@ -781,6 +840,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -793,6 +854,7 @@ def prepare_request(next_link=None): 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) @@ -804,6 +866,7 @@ def prepare_request(next_link=None): 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) @@ -821,7 +884,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]: @@ -834,7 +901,7 @@ async def get_next(next_link=None): 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 async def _power_off_initial( self, @@ -849,6 +916,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -860,6 +928,7 @@ async def _power_off_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._power_off_initial.metadata['url'], @@ -867,7 +936,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -883,7 +956,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -902,7 +975,8 @@ async def begin_power_off( :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. + :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -919,8 +993,9 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -932,6 +1007,7 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -956,10 +1032,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore async def _restart_initial( self, @@ -974,6 +1049,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -985,6 +1061,7 @@ async def _restart_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'], @@ -992,7 +1069,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1008,7 +1089,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -1025,7 +1106,8 @@ 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. + :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1042,8 +1124,9 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1055,6 +1138,7 @@ 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 @@ -1079,10 +1163,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore async def _start_initial( self, @@ -1097,6 +1180,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1108,6 +1192,7 @@ async def _start_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'], @@ -1115,7 +1200,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1131,7 +1220,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1148,7 +1237,8 @@ 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. + :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1165,8 +1255,9 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1178,6 +1269,7 @@ 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 @@ -1202,10 +1294,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore async def _update_instances_initial( self, @@ -1220,6 +1311,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1228,6 +1320,7 @@ async def _update_instances_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'], @@ -1235,7 +1328,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1251,7 +1348,7 @@ async def _update_instances_initial( return deserialized - _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 @distributed_trace_async @@ -1285,8 +1382,9 @@ async def begin_update_instances( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1298,6 +1396,7 @@ 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 @@ -1322,10 +1421,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) + 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 + begin_update_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore async def _reimage_initial( self, @@ -1339,17 +1437,24 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1365,7 +1470,7 @@ async def _reimage_initial( return deserialized - _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 @distributed_trace_async @@ -1395,7 +1500,8 @@ async def begin_reimage( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1406,6 +1512,7 @@ async def begin_reimage( raw_result = await self._reimage_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 ) @@ -1429,7 +1536,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_sizes_operations.py index 974922aaa35b..8de9e7cce536 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machines_operations.py index 4d78b077d7a2..adaa4dafc441 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -69,6 +69,7 @@ async def _capture_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'], @@ -76,7 +77,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -92,7 +97,7 @@ async def _capture_initial( 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 @@ -126,8 +131,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,6 +145,7 @@ 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 @@ -163,10 +170,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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -181,6 +187,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -189,6 +196,7 @@ async def _create_or_update_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'], @@ -196,7 +204,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -214,7 +226,7 @@ async def _create_or_update_initial( 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 @@ -247,8 +259,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -260,6 +273,7 @@ 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 @@ -284,10 +298,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _delete_initial( self, @@ -301,17 +314,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -327,7 +347,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -357,7 +377,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -368,6 +389,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -391,10 +413,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -410,8 +431,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -424,18 +445,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: 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) - 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]: @@ -449,7 +477,7 @@ async def get( 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 async def _deallocate_initial( @@ -464,17 +492,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -490,7 +525,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -521,7 +556,8 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -532,6 +568,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -555,10 +592,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async async def generalize( @@ -584,17 +620,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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) - 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]: @@ -608,7 +651,7 @@ async def generalize( return deserialized - 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 @@ -629,6 +672,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -640,6 +685,7 @@ def prepare_request(next_link=None): 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) @@ -650,6 +696,7 @@ def prepare_request(next_link=None): 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) @@ -667,7 +714,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]: @@ -680,7 +731,7 @@ async def get_next(next_link=None): 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( @@ -697,6 +748,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -707,6 +760,7 @@ def prepare_request(next_link=None): 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) @@ -716,6 +770,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -733,7 +788,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]: @@ -746,7 +805,7 @@ async def get_next(next_link=None): 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( @@ -769,6 +828,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -781,6 +842,7 @@ def prepare_request(next_link=None): 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) @@ -792,6 +854,7 @@ def prepare_request(next_link=None): 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) @@ -809,7 +872,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]: @@ -822,7 +889,7 @@ async def get_next(next_link=None): 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( self, @@ -836,17 +903,24 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -862,7 +936,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -893,7 +967,8 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -904,6 +979,7 @@ async def begin_power_off( raw_result = await self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -927,10 +1003,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore async def _restart_initial( self, @@ -944,17 +1019,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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) - 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]: @@ -970,7 +1052,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -1000,7 +1082,8 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1011,6 +1094,7 @@ 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 ) @@ -1034,10 +1118,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore async def _start_initial( self, @@ -1051,17 +1134,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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) - 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]: @@ -1077,7 +1167,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1107,7 +1197,8 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1118,6 +1209,7 @@ 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 ) @@ -1141,10 +1233,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore async def _redeploy_initial( self, @@ -1158,17 +1249,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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) - 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]: @@ -1184,7 +1282,7 @@ async def _redeploy_initial( return deserialized - _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 @distributed_trace_async @@ -1214,7 +1312,8 @@ async def begin_redeploy( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1225,6 +1324,7 @@ 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 ) @@ -1248,7 +1348,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_availability_sets_operations.py index 281179746831..87e7ac171e74 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -146,30 +148,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -180,31 +183,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,6 +261,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -265,6 +270,7 @@ def create_or_update( resource_group_name=resource_group_name, name=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'], @@ -272,7 +278,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -286,7 +296,7 @@ def create_or_update( 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 @@ -313,17 +323,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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) - 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]: @@ -339,7 +356,7 @@ def delete( return deserialized - 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 @@ -366,17 +383,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: 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) - 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,7 +414,7 @@ def get( 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 @@ -410,6 +434,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -421,6 +447,7 @@ def prepare_request(next_link=None): 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) @@ -431,6 +458,7 @@ def prepare_request(next_link=None): 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) @@ -448,7 +476,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 +493,7 @@ def get_next(next_link=None): 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( @@ -484,6 +516,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -496,6 +530,7 @@ def prepare_request(next_link=None): 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) @@ -507,6 +542,7 @@ def prepare_request(next_link=None): 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) @@ -524,7 +560,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]: @@ -537,4 +577,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_usage_operations.py index 9a33ba7c6763..963494612170 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extension_images_operations.py index 163b784fc964..b899b43d4597 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # 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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # 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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extensions_operations.py index 76c28b4e0fb6..3a07bbe5b841 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,10 +127,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -138,21 +139,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,10 +167,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -177,23 +179,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -233,6 +235,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -242,6 +245,7 @@ def _create_or_update_initial( 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'], @@ -249,7 +253,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -267,7 +275,7 @@ def _create_or_update_initial( 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 @@ -305,8 +313,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -319,6 +328,7 @@ 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 @@ -343,10 +353,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -362,6 +371,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -371,6 +381,7 @@ def _update_initial( 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'], @@ -378,7 +389,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -392,7 +407,7 @@ def _update_initial( 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 @@ -430,8 +445,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -444,6 +460,7 @@ 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 @@ -468,10 +485,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _delete_initial( self, @@ -486,18 +502,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -513,7 +536,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -546,7 +569,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -558,6 +582,7 @@ 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 ) @@ -581,10 +606,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -603,7 +627,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) @@ -616,19 +640,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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) - 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]: @@ -642,5 +673,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_images_operations.py index de5627a31634..6326dda98bd7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # 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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # 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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # 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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_set_vms_operations.py index 7a931865cdb9..b8c84445c78a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_reimage_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -46,21 +47,21 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,10 +73,11 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -83,21 +85,21 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -109,10 +111,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -120,21 +123,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -146,10 +149,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -157,21 +161,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,10 +187,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + _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'), @@ -194,21 +199,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -223,37 +228,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,10 +271,11 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -276,21 +283,21 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -302,10 +309,11 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -313,21 +321,21 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -339,10 +347,11 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -350,21 +359,21 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -403,18 +412,25 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -430,7 +446,7 @@ def _reimage_initial( return deserialized - _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 @distributed_trace @@ -463,7 +479,8 @@ def begin_reimage( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -475,6 +492,7 @@ def begin_reimage( 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 ) @@ -498,10 +516,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore def _deallocate_initial( self, @@ -516,18 +533,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -543,7 +567,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -578,7 +602,8 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -590,6 +615,7 @@ 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 ) @@ -613,10 +639,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _delete_initial( self, @@ -631,18 +656,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -658,7 +690,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -691,7 +723,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -703,6 +736,7 @@ def begin_delete( 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 ) @@ -726,10 +760,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -758,18 +791,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -783,7 +823,7 @@ def get( 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 @@ -813,18 +853,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: 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) - 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]: @@ -838,7 +885,7 @@ def get_instance_view( 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 @@ -859,12 +906,13 @@ 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 @@ -873,6 +921,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -885,6 +935,7 @@ def prepare_request(next_link=None): 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, @@ -899,6 +950,7 @@ def prepare_request(next_link=None): 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, @@ -919,7 +971,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]: @@ -932,7 +988,7 @@ def get_next(next_link=None): 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( self, @@ -947,18 +1003,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -974,7 +1037,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1009,7 +1072,8 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1021,6 +1085,7 @@ def begin_power_off( 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 ) @@ -1044,10 +1109,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore def _restart_initial( self, @@ -1062,18 +1126,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1089,7 +1160,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1122,7 +1193,8 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1134,6 +1206,7 @@ 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 ) @@ -1157,10 +1230,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore def _start_initial( self, @@ -1175,18 +1247,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1202,7 +1281,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1235,7 +1314,8 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1247,6 +1327,7 @@ 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 ) @@ -1270,7 +1351,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_sets_operations.py index 91baed210588..93a6705a5a14 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -79,31 +79,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -114,31 +115,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -152,35 +154,35 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -196,35 +198,35 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -237,31 +239,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -271,30 +274,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -303,29 +307,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -336,31 +341,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -374,35 +380,35 @@ def build_power_off_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -418,35 +424,35 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -462,35 +468,35 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -506,35 +512,35 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -547,35 +553,36 @@ def build_reimage_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -610,6 +617,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -618,6 +626,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, name=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'], @@ -625,7 +634,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -643,7 +656,7 @@ def _create_or_update_initial( 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 @@ -676,8 +689,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -689,6 +703,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -713,10 +728,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _delete_initial( self, @@ -730,17 +744,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -756,7 +777,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -786,7 +807,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -797,6 +819,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -820,10 +843,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -849,17 +871,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -873,7 +902,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _deallocate_initial( @@ -889,6 +918,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -900,6 +930,7 @@ def _deallocate_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'], @@ -907,7 +938,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -923,7 +958,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -942,7 +977,8 @@ 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. + :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -959,8 +995,9 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -972,6 +1009,7 @@ 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 @@ -996,10 +1034,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore def _delete_instances_initial( self, @@ -1014,6 +1051,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1022,6 +1060,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1029,7 +1068,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1045,7 +1088,7 @@ def _delete_instances_initial( return deserialized - _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 @distributed_trace @@ -1079,8 +1122,9 @@ def begin_delete_instances( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1092,6 +1136,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1116,10 +1161,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1145,17 +1189,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: 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) - 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]: @@ -1169,7 +1220,7 @@ def get_instance_view( 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 @@ -1189,6 +1240,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1200,6 +1253,7 @@ def prepare_request(next_link=None): 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) @@ -1210,6 +1264,7 @@ def prepare_request(next_link=None): 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) @@ -1227,7 +1282,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]: @@ -1240,7 +1299,7 @@ def get_next(next_link=None): 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( @@ -1258,6 +1317,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1268,6 +1329,7 @@ def prepare_request(next_link=None): 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) @@ -1277,6 +1339,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1294,7 +1357,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]: @@ -1307,7 +1374,7 @@ def get_next(next_link=None): 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( @@ -1330,6 +1397,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1342,6 +1411,7 @@ def prepare_request(next_link=None): 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) @@ -1353,6 +1423,7 @@ def prepare_request(next_link=None): 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) @@ -1370,7 +1441,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]: @@ -1383,7 +1458,7 @@ def get_next(next_link=None): 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 def _power_off_initial( self, @@ -1398,6 +1473,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1409,6 +1485,7 @@ def _power_off_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._power_off_initial.metadata['url'], @@ -1416,7 +1493,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1432,7 +1513,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1451,7 +1532,8 @@ def begin_power_off( :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. + :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1468,8 +1550,9 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1481,6 +1564,7 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1505,10 +1589,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore def _restart_initial( self, @@ -1523,6 +1606,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1534,6 +1618,7 @@ def _restart_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'], @@ -1541,7 +1626,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1557,7 +1646,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1574,7 +1663,8 @@ 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. + :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1591,8 +1681,9 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1604,6 +1695,7 @@ 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 @@ -1628,10 +1720,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore def _start_initial( self, @@ -1646,6 +1737,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1657,6 +1749,7 @@ def _start_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'], @@ -1664,7 +1757,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1680,7 +1777,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1697,7 +1794,8 @@ 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. + :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.v2015_06_15.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1714,8 +1812,9 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1727,6 +1826,7 @@ 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 @@ -1751,10 +1851,9 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore def _update_instances_initial( self, @@ -1769,6 +1868,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1777,6 +1877,7 @@ def _update_instances_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'], @@ -1784,7 +1885,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1800,7 +1905,7 @@ def _update_instances_initial( return deserialized - _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 @distributed_trace @@ -1834,8 +1939,9 @@ def begin_update_instances( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1847,6 +1953,7 @@ 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 @@ -1871,10 +1978,9 @@ 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) + 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 + begin_update_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore def _reimage_initial( self, @@ -1888,17 +1994,24 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1914,7 +2027,7 @@ def _reimage_initial( return deserialized - _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 @distributed_trace @@ -1944,7 +2057,8 @@ def begin_reimage( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1955,6 +2069,7 @@ def begin_reimage( raw_result = self._reimage_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 ) @@ -1978,7 +2093,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_sizes_operations.py index a27f72d43750..7a588960eca0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,6 +98,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -108,6 +111,7 @@ def prepare_request(next_link=None): 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) @@ -118,6 +122,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -135,7 +140,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]: @@ -148,4 +157,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machines_operations.py index 60737c81a8eb..ae2fdaaa1083 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2015-06-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -160,33 +161,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,31 +199,32 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -232,31 +235,32 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,30 +270,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -298,29 +303,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -331,31 +337,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -366,31 +373,32 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -401,31 +409,32 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -436,31 +445,32 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -471,35 +481,36 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2015-06-15" + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -534,6 +545,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -542,6 +554,7 @@ def _capture_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'], @@ -549,7 +562,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -565,7 +582,7 @@ def _capture_initial( 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 @@ -599,8 +616,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -612,6 +630,7 @@ 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 @@ -636,10 +655,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -654,6 +672,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -662,6 +681,7 @@ def _create_or_update_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'], @@ -669,7 +689,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -687,7 +711,7 @@ def _create_or_update_initial( 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 @@ -719,8 +743,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -732,6 +757,7 @@ 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 @@ -756,10 +782,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _delete_initial( self, @@ -773,17 +798,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -799,7 +831,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -829,7 +861,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -840,6 +873,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -863,10 +897,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -882,8 +915,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -896,18 +929,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: 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) - 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]: @@ -921,7 +961,7 @@ def get( 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 def _deallocate_initial( @@ -936,17 +976,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -962,7 +1009,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -993,7 +1040,8 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1004,6 +1052,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1027,10 +1076,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace def generalize( @@ -1056,17 +1104,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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) - 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]: @@ -1080,7 +1135,7 @@ def generalize( return deserialized - 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 @@ -1101,6 +1156,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1112,6 +1169,7 @@ def prepare_request(next_link=None): 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) @@ -1122,6 +1180,7 @@ def prepare_request(next_link=None): 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) @@ -1139,7 +1198,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]: @@ -1152,7 +1215,7 @@ def get_next(next_link=None): 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( @@ -1169,6 +1232,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1179,6 +1244,7 @@ def prepare_request(next_link=None): 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) @@ -1188,6 +1254,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1205,7 +1272,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]: @@ -1218,7 +1289,7 @@ def get_next(next_link=None): 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( @@ -1241,6 +1312,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2015_06_15.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1253,6 +1326,7 @@ def prepare_request(next_link=None): 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) @@ -1264,6 +1338,7 @@ def prepare_request(next_link=None): 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) @@ -1281,7 +1356,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]: @@ -1294,7 +1373,7 @@ def get_next(next_link=None): 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( self, @@ -1308,17 +1387,24 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1334,7 +1420,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1365,7 +1451,8 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1376,6 +1463,7 @@ def begin_power_off( raw_result = self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1399,10 +1487,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore def _restart_initial( self, @@ -1416,17 +1503,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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) - 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]: @@ -1442,7 +1536,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1472,7 +1566,8 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1483,6 +1578,7 @@ 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 ) @@ -1506,10 +1602,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore def _start_initial( self, @@ -1523,17 +1618,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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) - 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]: @@ -1549,7 +1651,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1579,7 +1681,8 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1590,6 +1693,7 @@ 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 ) @@ -1613,10 +1717,9 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore def _redeploy_initial( self, @@ -1630,17 +1733,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + 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) - 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]: @@ -1656,7 +1766,7 @@ def _redeploy_initial( return deserialized - _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 @distributed_trace @@ -1686,7 +1796,8 @@ def begin_redeploy( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2015_06_15.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2015-06-15") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1697,6 +1808,7 @@ 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 ) @@ -1720,7 +1832,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py index f8395dece2d7..0a5493b3e2c4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations @@ -54,8 +55,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2016-03-30". 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. """ @@ -87,7 +91,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_configuration.py index ed0d26925348..c91f802822f6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2016-03-30". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-03-30" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json index a65634d5bb6e..df678a73005d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py index baae22f61f24..3b4ee72dc335 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations @@ -55,8 +56,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2016-03-30". 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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_configuration.py index 8906051ff4d0..5e7ea2019928 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/_configuration.py @@ -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 "2016-03-30". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-03-30" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_availability_sets_operations.py index 8e2a29c3f6f0..c63164a29039 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( resource_group_name=resource_group_name, name=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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -129,17 +134,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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) - 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]: @@ -155,7 +167,7 @@ async def delete( return deserialized - 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 @@ -182,17 +194,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: 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) - 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]: @@ -206,7 +225,7 @@ async def get( 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 @@ -218,7 +237,7 @@ 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 @@ -227,6 +246,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -237,6 +258,7 @@ def prepare_request(next_link=None): 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'], ) @@ -247,6 +269,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -265,7 +288,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]: @@ -278,7 +305,7 @@ async def get_next(next_link=None): 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( @@ -297,6 +324,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -308,6 +337,7 @@ def prepare_request(next_link=None): 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) @@ -318,6 +348,7 @@ def prepare_request(next_link=None): 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) @@ -335,7 +366,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]: @@ -348,7 +383,7 @@ async def get_next(next_link=None): 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( @@ -371,6 +406,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -383,6 +420,7 @@ def prepare_request(next_link=None): 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) @@ -394,6 +432,7 @@ def prepare_request(next_link=None): 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) @@ -411,7 +450,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]: @@ -424,4 +467,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_usage_operations.py index 93aa548e2140..5ad1c3f681d3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extension_images_operations.py index bdcf257570d5..e521c8720fae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extensions_operations.py index 8bc8c140ab2a..11a3a5692d65 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,10 +309,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _delete_initial( self, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -340,7 +360,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -373,7 +393,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,6 +406,7 @@ 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 ) @@ -408,10 +430,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -430,7 +451,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) @@ -443,19 +464,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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) - 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]: @@ -469,5 +497,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_images_operations.py index f0c84fa577c5..70ae933979dd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py index c30a7c2e4ff5..7f20ce5310f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,18 +60,25 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -88,7 +94,7 @@ async def _reimage_initial( return deserialized - _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 @distributed_trace_async @@ -121,7 +127,8 @@ async def begin_reimage( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -133,6 +140,7 @@ async def begin_reimage( 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 ) @@ -156,10 +164,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore async def _deallocate_initial( self, @@ -174,18 +181,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -201,7 +215,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -236,7 +250,8 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -248,6 +263,7 @@ 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 ) @@ -271,10 +287,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _delete_initial( self, @@ -289,18 +304,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -316,7 +338,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -349,7 +371,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -361,6 +384,7 @@ async def begin_delete( 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 ) @@ -384,10 +408,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -416,18 +439,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -441,7 +471,7 @@ async def get( 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 @@ -471,18 +501,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: 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) - 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 +533,7 @@ async def get_instance_view( 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 @@ -517,12 +554,13 @@ 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 @@ -531,6 +569,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -543,6 +583,7 @@ def prepare_request(next_link=None): 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, @@ -557,6 +598,7 @@ def prepare_request(next_link=None): 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, @@ -577,7 +619,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]: @@ -590,7 +636,7 @@ async def get_next(next_link=None): 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( self, @@ -605,18 +651,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -632,7 +685,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -667,7 +720,8 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -679,6 +733,7 @@ async def begin_power_off( 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 ) @@ -702,10 +757,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore async def _restart_initial( self, @@ -720,18 +774,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -747,7 +808,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -780,7 +841,8 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -792,6 +854,7 @@ 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 ) @@ -815,10 +878,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore async def _start_initial( self, @@ -833,18 +895,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -860,7 +929,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -893,7 +962,8 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -905,6 +975,7 @@ 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 ) @@ -928,7 +999,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_sets_operations.py index c6e3913d23cb..8660ebdc4e9c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, name=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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _delete_initial( self, @@ -181,17 +187,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -207,7 +220,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -237,7 +250,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -248,6 +262,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -271,10 +286,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -300,17 +314,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -324,7 +345,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _deallocate_initial( @@ -340,6 +361,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -351,6 +373,7 @@ async def _deallocate_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'], @@ -358,7 +381,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -374,7 +401,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -393,7 +420,8 @@ 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. + :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -410,8 +438,9 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -423,6 +452,7 @@ 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 @@ -447,10 +477,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore async def _delete_instances_initial( self, @@ -465,6 +494,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -473,6 +503,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -480,7 +511,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -496,7 +531,7 @@ async def _delete_instances_initial( return deserialized - _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 @distributed_trace_async @@ -530,8 +565,9 @@ async def begin_delete_instances( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -543,6 +579,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -567,10 +604,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) + 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 + 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( @@ -596,17 +632,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: 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) - 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]: @@ -620,7 +663,7 @@ async def get_instance_view( 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 @@ -640,6 +683,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -651,6 +696,7 @@ def prepare_request(next_link=None): 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) @@ -661,6 +707,7 @@ def prepare_request(next_link=None): 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) @@ -678,7 +725,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]: @@ -691,7 +742,7 @@ async def get_next(next_link=None): 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( @@ -709,6 +760,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -719,6 +772,7 @@ def prepare_request(next_link=None): 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) @@ -728,6 +782,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -745,7 +800,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]: @@ -758,7 +817,7 @@ async def get_next(next_link=None): 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( @@ -781,6 +840,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -793,6 +854,7 @@ def prepare_request(next_link=None): 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) @@ -804,6 +866,7 @@ def prepare_request(next_link=None): 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) @@ -821,7 +884,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]: @@ -834,7 +901,7 @@ async def get_next(next_link=None): 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 async def _power_off_initial( self, @@ -849,6 +916,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -860,6 +928,7 @@ async def _power_off_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._power_off_initial.metadata['url'], @@ -867,7 +936,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -883,7 +956,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -902,7 +975,8 @@ async def begin_power_off( :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. + :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -919,8 +993,9 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -932,6 +1007,7 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -956,10 +1032,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore async def _restart_initial( self, @@ -974,6 +1049,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -985,6 +1061,7 @@ async def _restart_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'], @@ -992,7 +1069,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1008,7 +1089,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -1025,7 +1106,8 @@ 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. + :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1042,8 +1124,9 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1055,6 +1138,7 @@ 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 @@ -1079,10 +1163,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore async def _start_initial( self, @@ -1097,6 +1180,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1108,6 +1192,7 @@ async def _start_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'], @@ -1115,7 +1200,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1131,7 +1220,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1148,7 +1237,8 @@ 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. + :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1165,8 +1255,9 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1178,6 +1269,7 @@ 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 @@ -1202,10 +1294,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore async def _update_instances_initial( self, @@ -1220,6 +1311,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1228,6 +1320,7 @@ async def _update_instances_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'], @@ -1235,7 +1328,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1251,7 +1348,7 @@ async def _update_instances_initial( return deserialized - _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 @distributed_trace_async @@ -1285,8 +1382,9 @@ async def begin_update_instances( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1298,6 +1396,7 @@ 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 @@ -1322,10 +1421,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) + 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 + begin_update_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore async def _reimage_initial( self, @@ -1339,17 +1437,24 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1365,7 +1470,7 @@ async def _reimage_initial( return deserialized - _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 @distributed_trace_async @@ -1395,7 +1500,8 @@ async def begin_reimage( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1406,6 +1512,7 @@ async def begin_reimage( raw_result = await self._reimage_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 ) @@ -1429,7 +1536,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_sizes_operations.py index 1d523dda32a3..6b0473e99828 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machines_operations.py index 7ec08c86fc78..2a0010097970 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -62,7 +61,7 @@ async def get_extensions( :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) @@ -75,18 +74,25 @@ async def get_extensions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_get_extensions_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_extensions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -100,7 +106,7 @@ async def get_extensions( return deserialized - get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + get_extensions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore async def _capture_initial( @@ -116,6 +122,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -124,6 +131,7 @@ async def _capture_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'], @@ -131,7 +139,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -147,7 +159,7 @@ async def _capture_initial( 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 @@ -181,8 +193,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -194,6 +207,7 @@ 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 @@ -218,10 +232,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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -236,6 +249,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -244,6 +258,7 @@ async def _create_or_update_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'], @@ -251,7 +266,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -269,7 +288,7 @@ async def _create_or_update_initial( 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 @@ -302,8 +321,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -315,6 +335,7 @@ 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 @@ -339,10 +360,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _delete_initial( self, @@ -356,17 +376,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -382,7 +409,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -412,7 +439,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -423,6 +451,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -446,10 +475,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -465,8 +493,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -479,18 +507,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: 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) - 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]: @@ -504,7 +539,7 @@ async def get( 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 async def _deallocate_initial( @@ -519,17 +554,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -545,7 +587,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -576,7 +618,8 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -587,6 +630,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -610,10 +654,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async async def generalize( @@ -639,17 +682,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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) - 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]: @@ -663,7 +713,7 @@ async def generalize( return deserialized - 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 @@ -684,6 +734,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -695,6 +747,7 @@ def prepare_request(next_link=None): 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) @@ -705,6 +758,7 @@ def prepare_request(next_link=None): 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) @@ -722,7 +776,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]: @@ -735,7 +793,7 @@ async def get_next(next_link=None): 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( @@ -752,6 +810,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -762,6 +822,7 @@ def prepare_request(next_link=None): 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) @@ -771,6 +832,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -788,7 +850,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]: @@ -801,7 +867,7 @@ async def get_next(next_link=None): 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( @@ -824,6 +890,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -836,6 +904,7 @@ def prepare_request(next_link=None): 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) @@ -847,6 +916,7 @@ def prepare_request(next_link=None): 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) @@ -864,7 +934,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]: @@ -877,7 +951,7 @@ async def get_next(next_link=None): 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( self, @@ -891,17 +965,24 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -917,7 +998,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -948,7 +1029,8 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -959,6 +1041,7 @@ async def begin_power_off( raw_result = await self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -982,10 +1065,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore async def _restart_initial( self, @@ -999,17 +1081,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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) - 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]: @@ -1025,7 +1114,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -1055,7 +1144,8 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1066,6 +1156,7 @@ 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 ) @@ -1089,10 +1180,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore async def _start_initial( self, @@ -1106,17 +1196,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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) - 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]: @@ -1132,7 +1229,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1162,7 +1259,8 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1173,6 +1271,7 @@ 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 ) @@ -1196,10 +1295,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore async def _redeploy_initial( self, @@ -1213,17 +1311,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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) - 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]: @@ -1239,7 +1344,7 @@ async def _redeploy_initial( return deserialized - _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 @distributed_trace_async @@ -1269,7 +1374,8 @@ async def begin_redeploy( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1280,6 +1386,7 @@ 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 ) @@ -1303,7 +1410,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_availability_sets_operations.py index 9d954c610a10..c5f9fbcc78db 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -147,31 +149,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -181,30 +184,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,31 +219,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -292,6 +297,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -300,6 +306,7 @@ def create_or_update( resource_group_name=resource_group_name, name=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'], @@ -307,7 +314,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -321,7 +332,7 @@ def create_or_update( 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 @@ -348,17 +359,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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) - 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]: @@ -374,7 +392,7 @@ def delete( return deserialized - 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 @@ -401,17 +419,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: 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) - 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]: @@ -425,7 +450,7 @@ def get( 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 @@ -437,7 +462,7 @@ 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 @@ -446,6 +471,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -456,6 +483,7 @@ def prepare_request(next_link=None): 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'], ) @@ -466,6 +494,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -484,7 +513,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]: @@ -497,7 +530,7 @@ def get_next(next_link=None): 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( @@ -516,6 +549,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -527,6 +562,7 @@ def prepare_request(next_link=None): 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) @@ -537,6 +573,7 @@ def prepare_request(next_link=None): 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) @@ -554,7 +591,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]: @@ -567,7 +608,7 @@ def get_next(next_link=None): 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( @@ -590,6 +631,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -602,6 +645,7 @@ def prepare_request(next_link=None): 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) @@ -613,6 +657,7 @@ def prepare_request(next_link=None): 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) @@ -630,7 +675,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]: @@ -643,4 +692,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_usage_operations.py index 112d3ab5ef77..e6e753220fd1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extension_images_operations.py index 73256bd71ed5..e0426846588f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # 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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # 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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extensions_operations.py index 927bc5bd55a6..eb64d41a039c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,10 +127,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -138,21 +139,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,10 +167,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -177,23 +179,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -233,6 +235,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -242,6 +245,7 @@ def _create_or_update_initial( 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'], @@ -249,7 +253,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -267,7 +275,7 @@ def _create_or_update_initial( 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 @@ -305,8 +313,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -319,6 +328,7 @@ 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 @@ -343,10 +353,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -362,6 +371,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -371,6 +381,7 @@ def _update_initial( 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'], @@ -378,7 +389,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -392,7 +407,7 @@ def _update_initial( 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 @@ -430,8 +445,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -444,6 +460,7 @@ 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 @@ -468,10 +485,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _delete_initial( self, @@ -486,18 +502,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -513,7 +536,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -546,7 +569,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -558,6 +582,7 @@ 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 ) @@ -581,10 +606,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -603,7 +627,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) @@ -616,19 +640,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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) - 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]: @@ -642,5 +673,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_images_operations.py index 1bab52f1780b..6ca478a8bb6b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # 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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # 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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # 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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_set_vms_operations.py index b1c69c0b98f4..f6e52ecb3411 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_reimage_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -46,21 +47,21 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,10 +73,11 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -83,21 +85,21 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -109,10 +111,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -120,21 +123,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -146,10 +149,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -157,21 +161,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,10 +187,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + _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'), @@ -194,21 +199,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -223,37 +228,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,10 +271,11 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -276,21 +283,21 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -302,10 +309,11 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -313,21 +321,21 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -339,10 +347,11 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -350,21 +359,21 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -403,18 +412,25 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -430,7 +446,7 @@ def _reimage_initial( return deserialized - _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 @distributed_trace @@ -463,7 +479,8 @@ def begin_reimage( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -475,6 +492,7 @@ def begin_reimage( 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 ) @@ -498,10 +516,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore def _deallocate_initial( self, @@ -516,18 +533,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -543,7 +567,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -578,7 +602,8 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -590,6 +615,7 @@ 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 ) @@ -613,10 +639,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _delete_initial( self, @@ -631,18 +656,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -658,7 +690,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -691,7 +723,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -703,6 +736,7 @@ def begin_delete( 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 ) @@ -726,10 +760,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -758,18 +791,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -783,7 +823,7 @@ def get( 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 @@ -813,18 +853,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: 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) - 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]: @@ -838,7 +885,7 @@ def get_instance_view( 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 @@ -859,12 +906,13 @@ 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 @@ -873,6 +921,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -885,6 +935,7 @@ def prepare_request(next_link=None): 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, @@ -899,6 +950,7 @@ def prepare_request(next_link=None): 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, @@ -919,7 +971,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]: @@ -932,7 +988,7 @@ def get_next(next_link=None): 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( self, @@ -947,18 +1003,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -974,7 +1037,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1009,7 +1072,8 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1021,6 +1085,7 @@ def begin_power_off( 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 ) @@ -1044,10 +1109,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore def _restart_initial( self, @@ -1062,18 +1126,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1089,7 +1160,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1122,7 +1193,8 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1134,6 +1206,7 @@ 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 ) @@ -1157,10 +1230,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore def _start_initial( self, @@ -1175,18 +1247,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1202,7 +1281,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1235,7 +1314,8 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1247,6 +1327,7 @@ 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 ) @@ -1270,7 +1351,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_sets_operations.py index 1288111dd4ae..9987088a5c30 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -79,31 +79,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -114,31 +115,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -152,35 +154,35 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -196,35 +198,35 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -237,31 +239,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -271,30 +274,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -303,29 +307,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -336,31 +341,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -374,35 +380,35 @@ def build_power_off_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -418,35 +424,35 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -462,35 +468,35 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -506,35 +512,35 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -547,35 +553,36 @@ def build_reimage_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -610,6 +617,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -618,6 +626,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, name=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'], @@ -625,7 +634,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -643,7 +656,7 @@ def _create_or_update_initial( 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 @@ -676,8 +689,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -689,6 +703,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -713,10 +728,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _delete_initial( self, @@ -730,17 +744,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -756,7 +777,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -786,7 +807,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -797,6 +819,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -820,10 +843,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -849,17 +871,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -873,7 +902,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _deallocate_initial( @@ -889,6 +918,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -900,6 +930,7 @@ def _deallocate_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'], @@ -907,7 +938,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -923,7 +958,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -942,7 +977,8 @@ 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. + :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -959,8 +995,9 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -972,6 +1009,7 @@ 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 @@ -996,10 +1034,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore def _delete_instances_initial( self, @@ -1014,6 +1051,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1022,6 +1060,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1029,7 +1068,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1045,7 +1088,7 @@ def _delete_instances_initial( return deserialized - _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 @distributed_trace @@ -1079,8 +1122,9 @@ def begin_delete_instances( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1092,6 +1136,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1116,10 +1161,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1145,17 +1189,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: 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) - 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]: @@ -1169,7 +1220,7 @@ def get_instance_view( 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 @@ -1189,6 +1240,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1200,6 +1253,7 @@ def prepare_request(next_link=None): 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) @@ -1210,6 +1264,7 @@ def prepare_request(next_link=None): 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) @@ -1227,7 +1282,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]: @@ -1240,7 +1299,7 @@ def get_next(next_link=None): 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( @@ -1258,6 +1317,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1268,6 +1329,7 @@ def prepare_request(next_link=None): 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) @@ -1277,6 +1339,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1294,7 +1357,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]: @@ -1307,7 +1374,7 @@ def get_next(next_link=None): 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( @@ -1330,6 +1397,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1342,6 +1411,7 @@ def prepare_request(next_link=None): 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) @@ -1353,6 +1423,7 @@ def prepare_request(next_link=None): 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) @@ -1370,7 +1441,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]: @@ -1383,7 +1458,7 @@ def get_next(next_link=None): 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 def _power_off_initial( self, @@ -1398,6 +1473,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1409,6 +1485,7 @@ def _power_off_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._power_off_initial.metadata['url'], @@ -1416,7 +1493,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1432,7 +1513,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1451,7 +1532,8 @@ def begin_power_off( :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. + :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1468,8 +1550,9 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1481,6 +1564,7 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1505,10 +1589,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore def _restart_initial( self, @@ -1523,6 +1606,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1534,6 +1618,7 @@ def _restart_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'], @@ -1541,7 +1626,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1557,7 +1646,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1574,7 +1663,8 @@ 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. + :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1591,8 +1681,9 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1604,6 +1695,7 @@ 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 @@ -1628,10 +1720,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore def _start_initial( self, @@ -1646,6 +1737,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1657,6 +1749,7 @@ def _start_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'], @@ -1664,7 +1757,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1680,7 +1777,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1697,7 +1794,8 @@ 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. + :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.v2016_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1714,8 +1812,9 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1727,6 +1826,7 @@ 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 @@ -1751,10 +1851,9 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore def _update_instances_initial( self, @@ -1769,6 +1868,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1777,6 +1877,7 @@ def _update_instances_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'], @@ -1784,7 +1885,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1800,7 +1905,7 @@ def _update_instances_initial( return deserialized - _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 @distributed_trace @@ -1834,8 +1939,9 @@ def begin_update_instances( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1847,6 +1953,7 @@ 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 @@ -1871,10 +1978,9 @@ 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) + 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 + begin_update_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore def _reimage_initial( self, @@ -1888,17 +1994,24 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1914,7 +2027,7 @@ def _reimage_initial( return deserialized - _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 @distributed_trace @@ -1944,7 +2057,8 @@ def begin_reimage( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1955,6 +2069,7 @@ def begin_reimage( raw_result = self._reimage_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 ) @@ -1978,7 +2093,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_sizes_operations.py index 4717b7f6e74d..1e77420edcba 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,6 +98,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -108,6 +111,7 @@ def prepare_request(next_link=None): 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) @@ -118,6 +122,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -135,7 +140,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]: @@ -148,4 +157,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machines_operations.py index a285b4226ca6..276c2eb4aa23 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,33 +37,34 @@ def build_get_extensions_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -77,35 +78,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,35 +122,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -162,31 +163,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,33 +201,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -236,31 +239,32 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -271,31 +275,32 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -305,30 +310,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -337,29 +343,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -370,31 +377,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -405,31 +413,32 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -440,31 +449,32 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -475,31 +485,32 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -510,35 +521,36 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-03-30" + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -574,7 +586,7 @@ def get_extensions( :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) @@ -587,18 +599,25 @@ def get_extensions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + request = build_get_extensions_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_extensions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -612,7 +631,7 @@ def get_extensions( return deserialized - get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + get_extensions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore def _capture_initial( @@ -628,6 +647,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -636,6 +656,7 @@ def _capture_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'], @@ -643,7 +664,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -659,7 +684,7 @@ def _capture_initial( 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 @@ -693,8 +718,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -706,6 +732,7 @@ 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 @@ -730,10 +757,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -748,6 +774,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -756,6 +783,7 @@ def _create_or_update_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'], @@ -763,7 +791,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -781,7 +813,7 @@ def _create_or_update_initial( 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 @@ -813,8 +845,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -826,6 +859,7 @@ 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 @@ -850,10 +884,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _delete_initial( self, @@ -867,17 +900,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -893,7 +933,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -923,7 +963,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -934,6 +975,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -957,10 +999,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -976,8 +1017,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -990,18 +1031,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: 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) - 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]: @@ -1015,7 +1063,7 @@ def get( 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 def _deallocate_initial( @@ -1030,17 +1078,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1056,7 +1111,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -1087,7 +1142,8 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1098,6 +1154,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1121,10 +1178,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace def generalize( @@ -1150,17 +1206,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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) - 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]: @@ -1174,7 +1237,7 @@ def generalize( return deserialized - 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 @@ -1195,6 +1258,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1206,6 +1271,7 @@ def prepare_request(next_link=None): 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) @@ -1216,6 +1282,7 @@ def prepare_request(next_link=None): 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) @@ -1233,7 +1300,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,7 +1317,7 @@ def get_next(next_link=None): 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( @@ -1263,6 +1334,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1273,6 +1346,7 @@ def prepare_request(next_link=None): 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) @@ -1282,6 +1356,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1299,7 +1374,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]: @@ -1312,7 +1391,7 @@ def get_next(next_link=None): 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( @@ -1335,6 +1414,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1347,6 +1428,7 @@ def prepare_request(next_link=None): 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) @@ -1358,6 +1440,7 @@ def prepare_request(next_link=None): 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) @@ -1375,7 +1458,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]: @@ -1388,7 +1475,7 @@ def get_next(next_link=None): 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( self, @@ -1402,17 +1489,24 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1428,7 +1522,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1459,7 +1553,8 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1470,6 +1565,7 @@ def begin_power_off( raw_result = self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1493,10 +1589,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore def _restart_initial( self, @@ -1510,17 +1605,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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) - 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]: @@ -1536,7 +1638,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1566,7 +1668,8 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1577,6 +1680,7 @@ 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 ) @@ -1600,10 +1704,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore def _start_initial( self, @@ -1617,17 +1720,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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) - 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]: @@ -1643,7 +1753,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1673,7 +1783,8 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1684,6 +1795,7 @@ 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 ) @@ -1707,10 +1819,9 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore def _redeploy_initial( self, @@ -1724,17 +1835,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + 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) - 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]: @@ -1750,7 +1868,7 @@ def _redeploy_initial( return deserialized - _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 @distributed_trace @@ -1780,7 +1898,8 @@ def begin_redeploy( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1791,6 +1910,7 @@ 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 ) @@ -1814,7 +1934,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_compute_management_client.py index d40709bf86c0..c764717c9c07 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations @@ -61,8 +62,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2016-04-30-preview". 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. """ @@ -97,7 +101,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_configuration.py index e3eae507a3e3..a0d7e8b05992 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2016-04-30-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-04-30-preview" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_metadata.json index c7fd8a485008..6593df10bf9c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_compute_management_client.py index 9ffc5aa825ff..618f7e8ca317 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations @@ -61,8 +62,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2016-04-30-preview". 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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_configuration.py index 55eb5f49c12e..85dd2176820c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/_configuration.py @@ -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 "2016-04-30-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-04-30-preview" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_availability_sets_operations.py index 2437b64c67ff..5c8cafd19e98 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( resource_group_name=resource_group_name, name=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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -129,17 +134,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -155,7 +167,7 @@ async def delete( return deserialized - 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 @@ -182,17 +194,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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) - 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]: @@ -206,7 +225,7 @@ async def get( 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 @@ -223,6 +242,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -233,6 +254,7 @@ def prepare_request(next_link=None): 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) @@ -242,6 +264,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -259,7 +282,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]: @@ -272,7 +299,7 @@ async def get_next(next_link=None): 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( @@ -291,6 +318,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -302,6 +331,7 @@ def prepare_request(next_link=None): 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) @@ -312,6 +342,7 @@ def prepare_request(next_link=None): 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) @@ -329,7 +360,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]: @@ -342,7 +377,7 @@ async def get_next(next_link=None): 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( @@ -365,6 +400,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -377,6 +414,7 @@ def prepare_request(next_link=None): 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) @@ -388,6 +426,7 @@ def prepare_request(next_link=None): 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) @@ -405,7 +444,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]: @@ -418,4 +461,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_disks_operations.py index 9cf3ea3e2b84..8141b9f1c2ea 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,7 +360,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _delete_initial( @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -381,7 +408,7 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -413,7 +440,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -424,6 +452,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -447,10 +476,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -468,6 +496,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -479,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -489,6 +520,7 @@ def prepare_request(next_link=None): 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) @@ -506,7 +538,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]: @@ -519,7 +555,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -534,6 +570,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -544,6 +582,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -553,6 +592,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -570,7 +610,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]: @@ -583,7 +627,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -598,6 +642,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -606,6 +651,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -613,7 +659,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -629,7 +679,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -665,8 +715,9 @@ async def begin_grant_access( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -678,6 +729,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -702,10 +754,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore async def _revoke_access_initial( self, @@ -719,17 +770,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -745,7 +803,7 @@ async def _revoke_access_initial( return deserialized - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async @@ -777,7 +835,8 @@ async def begin_revoke_access( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -788,6 +847,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -811,7 +871,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_images_operations.py index 716d17b9a461..3e18b4ce2ffe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -126,8 +131,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -139,6 +145,7 @@ 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 @@ -163,10 +170,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _delete_initial( self, @@ -180,17 +186,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -206,7 +219,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -236,7 +249,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -247,6 +261,7 @@ 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 ) @@ -270,10 +285,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -289,7 +303,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) @@ -302,18 +316,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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) - 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]: @@ -327,7 +348,7 @@ async def get( 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 @@ -346,6 +367,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -357,6 +380,7 @@ def prepare_request(next_link=None): 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) @@ -367,6 +391,7 @@ def prepare_request(next_link=None): 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) @@ -384,7 +409,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]: @@ -397,7 +426,7 @@ async def get_next(next_link=None): 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( @@ -413,6 +442,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -423,6 +454,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -432,6 +464,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -449,7 +482,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]: @@ -462,4 +499,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_snapshots_operations.py index 1fbcd48a7375..cf4ce48c7106 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -317,17 +330,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -341,7 +361,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _delete_initial( @@ -356,17 +376,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -382,7 +409,7 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -413,7 +440,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -424,6 +452,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -447,10 +476,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -468,6 +496,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -479,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -489,6 +520,7 @@ def prepare_request(next_link=None): 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) @@ -506,7 +538,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]: @@ -519,7 +555,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -534,6 +570,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -544,6 +582,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -553,6 +592,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -570,7 +610,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]: @@ -583,7 +627,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -598,6 +642,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -606,6 +651,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -613,7 +659,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -629,7 +679,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -664,8 +714,9 @@ async def begin_grant_access( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -677,6 +728,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -701,10 +753,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore async def _revoke_access_initial( self, @@ -718,17 +769,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -744,7 +802,7 @@ async def _revoke_access_initial( return deserialized - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async @@ -775,7 +833,8 @@ async def begin_revoke_access( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -786,6 +845,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -809,7 +869,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_usage_operations.py index 7da21a1c8e89..d56caab494ea 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extension_images_operations.py index 087402654174..4643cd129905 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extensions_operations.py index 249df72bebaa..39ca50df9f47 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -133,8 +138,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -147,6 +153,7 @@ 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 @@ -171,10 +178,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -190,6 +196,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -199,6 +206,7 @@ async def _update_initial( 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'], @@ -206,7 +214,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -220,7 +232,7 @@ async def _update_initial( 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 @@ -258,8 +270,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -272,6 +285,7 @@ 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 @@ -296,10 +310,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _delete_initial( self, @@ -314,18 +327,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -341,7 +361,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -374,7 +394,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -386,6 +407,7 @@ 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 ) @@ -409,10 +431,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -431,7 +452,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) @@ -444,19 +465,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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) - 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]: @@ -470,5 +498,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_images_operations.py index e81e2dc2f563..2f50824f3d57 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_set_vms_operations.py index 9852e0c26fe8..4303c19e09e4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,18 +60,25 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -88,7 +94,7 @@ async def _reimage_initial( return deserialized - _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 @distributed_trace_async @@ -121,7 +127,8 @@ async def begin_reimage( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -133,6 +140,7 @@ async def begin_reimage( 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 ) @@ -156,10 +164,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore async def _reimage_all_initial( self, @@ -174,18 +181,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -201,7 +215,7 @@ async def _reimage_all_initial( return deserialized - _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 @distributed_trace_async @@ -235,7 +249,8 @@ async def begin_reimage_all( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -247,6 +262,7 @@ 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 ) @@ -270,10 +286,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) + 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 + begin_reimage_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall"} # type: ignore async def _deallocate_initial( self, @@ -288,18 +303,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -315,7 +337,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -350,7 +372,8 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -362,6 +385,7 @@ 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 ) @@ -385,10 +409,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _delete_initial( self, @@ -403,18 +426,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -430,7 +460,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -463,7 +493,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -475,6 +506,7 @@ async def begin_delete( 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 ) @@ -498,10 +530,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -530,18 +561,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -555,7 +593,7 @@ async def get( 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 @@ -585,18 +623,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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) - 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 +655,7 @@ async def get_instance_view( 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 @@ -629,11 +674,11 @@ def list( :type resource_group_name: str :param virtual_machine_scale_set_name: The name of the VM scale set. :type virtual_machine_scale_set_name: str - :param filter: The filter to apply to the operation. + :param filter: The filter to apply to the operation. Default value is None. :type filter: str - :param select: The list parameters. + :param select: The list parameters. Default value is None. :type select: str - :param expand: The expand expression to apply to the operation. + :param expand: The expand expression to apply to 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 VirtualMachineScaleSetVMListResult or the result @@ -642,6 +687,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -654,6 +701,7 @@ def prepare_request(next_link=None): 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, @@ -668,6 +716,7 @@ def prepare_request(next_link=None): 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, @@ -688,7 +737,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]: @@ -701,7 +754,7 @@ async def get_next(next_link=None): 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( self, @@ -716,18 +769,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -743,7 +803,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -778,7 +838,8 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -790,6 +851,7 @@ async def begin_power_off( 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 ) @@ -813,10 +875,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore async def _restart_initial( self, @@ -831,18 +892,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -858,7 +926,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -891,7 +959,8 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -903,6 +972,7 @@ 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 ) @@ -926,10 +996,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore async def _start_initial( self, @@ -944,18 +1013,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -971,7 +1047,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1004,7 +1080,8 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1016,6 +1093,7 @@ 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 ) @@ -1039,7 +1117,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_sets_operations.py index 34980fbdbb70..3e6df329fb84 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, name=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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _delete_initial( self, @@ -181,17 +187,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -207,7 +220,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -237,7 +250,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -248,6 +262,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -271,10 +286,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -300,17 +314,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -324,7 +345,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _deallocate_initial( @@ -340,6 +361,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -351,6 +373,7 @@ async def _deallocate_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'], @@ -358,7 +381,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -374,7 +401,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -393,7 +420,8 @@ 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. + :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -410,8 +438,9 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -423,6 +452,7 @@ 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 @@ -447,10 +477,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore async def _delete_instances_initial( self, @@ -465,6 +494,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -473,6 +503,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -480,7 +511,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -496,7 +531,7 @@ async def _delete_instances_initial( return deserialized - _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 @distributed_trace_async @@ -530,8 +565,9 @@ async def begin_delete_instances( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -543,6 +579,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -567,10 +604,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) + 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 + 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( @@ -596,17 +632,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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) - 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]: @@ -620,7 +663,7 @@ async def get_instance_view( 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 @@ -640,6 +683,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -651,6 +696,7 @@ def prepare_request(next_link=None): 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) @@ -661,6 +707,7 @@ def prepare_request(next_link=None): 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) @@ -678,7 +725,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]: @@ -691,7 +742,7 @@ async def get_next(next_link=None): 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( @@ -709,6 +760,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -719,6 +772,7 @@ def prepare_request(next_link=None): 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) @@ -728,6 +782,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -745,7 +800,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]: @@ -758,7 +817,7 @@ async def get_next(next_link=None): 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( @@ -781,6 +840,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -793,6 +854,7 @@ def prepare_request(next_link=None): 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) @@ -804,6 +866,7 @@ def prepare_request(next_link=None): 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) @@ -821,7 +884,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]: @@ -834,7 +901,7 @@ async def get_next(next_link=None): 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 async def _power_off_initial( self, @@ -849,6 +916,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -860,6 +928,7 @@ async def _power_off_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._power_off_initial.metadata['url'], @@ -867,7 +936,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -883,7 +956,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -902,7 +975,8 @@ async def begin_power_off( :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. + :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -919,8 +993,9 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -932,6 +1007,7 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -956,10 +1032,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore async def _restart_initial( self, @@ -974,6 +1049,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -985,6 +1061,7 @@ async def _restart_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'], @@ -992,7 +1069,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1008,7 +1089,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -1025,7 +1106,8 @@ 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. + :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1042,8 +1124,9 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1055,6 +1138,7 @@ 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 @@ -1079,10 +1163,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore async def _start_initial( self, @@ -1097,6 +1180,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1108,6 +1192,7 @@ async def _start_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'], @@ -1115,7 +1200,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1131,7 +1220,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1148,7 +1237,8 @@ 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. + :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1165,8 +1255,9 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1178,6 +1269,7 @@ 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 @@ -1202,10 +1294,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore async def _update_instances_initial( self, @@ -1220,6 +1311,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1228,6 +1320,7 @@ async def _update_instances_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'], @@ -1235,7 +1328,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1251,7 +1348,7 @@ async def _update_instances_initial( return deserialized - _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 @distributed_trace_async @@ -1285,8 +1382,9 @@ async def begin_update_instances( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1298,6 +1396,7 @@ 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 @@ -1322,10 +1421,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) + 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 + begin_update_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore async def _reimage_initial( self, @@ -1339,17 +1437,24 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1365,7 +1470,7 @@ async def _reimage_initial( return deserialized - _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 @distributed_trace_async @@ -1395,7 +1500,8 @@ async def begin_reimage( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1406,6 +1512,7 @@ async def begin_reimage( raw_result = await self._reimage_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 ) @@ -1429,10 +1536,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore async def _reimage_all_initial( self, @@ -1446,17 +1552,24 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1472,7 +1585,7 @@ async def _reimage_all_initial( return deserialized - _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 @distributed_trace_async @@ -1503,7 +1616,8 @@ async def begin_reimage_all( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1514,6 +1628,7 @@ async def begin_reimage_all( raw_result = await self._reimage_all_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 ) @@ -1537,7 +1652,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) + 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 + begin_reimage_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_sizes_operations.py index d8e05988f275..2b736c0dffaa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machines_operations.py index 051ebe771682..bd6e2c9002f9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -62,7 +61,7 @@ async def get_extensions( :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) @@ -75,18 +74,25 @@ async def get_extensions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_get_extensions_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_extensions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -100,7 +106,7 @@ async def get_extensions( return deserialized - get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + get_extensions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore async def _capture_initial( @@ -116,6 +122,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -124,6 +131,7 @@ async def _capture_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'], @@ -131,7 +139,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -147,7 +159,7 @@ async def _capture_initial( 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 @@ -182,8 +194,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -195,6 +208,7 @@ 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 @@ -219,10 +233,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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -237,6 +250,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -245,6 +259,7 @@ async def _create_or_update_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'], @@ -252,7 +267,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -270,7 +289,7 @@ async def _create_or_update_initial( 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 @@ -303,8 +322,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -316,6 +336,7 @@ 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 @@ -340,10 +361,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _delete_initial( self, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -383,7 +410,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -413,7 +440,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -424,6 +452,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -447,10 +476,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -466,8 +494,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -480,18 +508,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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) - 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]: @@ -505,7 +540,7 @@ async def get( 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 async def _convert_to_managed_disks_initial( @@ -520,17 +555,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -546,7 +588,7 @@ async def _convert_to_managed_disks_initial( return deserialized - _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 @distributed_trace_async @@ -577,7 +619,8 @@ async def begin_convert_to_managed_disks( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -588,6 +631,7 @@ 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 ) @@ -611,10 +655,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) + 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 + begin_convert_to_managed_disks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks"} # type: ignore async def _deallocate_initial( self, @@ -628,17 +671,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -654,7 +704,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -685,7 +735,8 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -696,6 +747,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -719,10 +771,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async async def generalize( @@ -748,17 +799,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -772,7 +830,7 @@ async def generalize( return deserialized - 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 @@ -793,6 +851,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -804,6 +864,7 @@ def prepare_request(next_link=None): 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) @@ -814,6 +875,7 @@ def prepare_request(next_link=None): 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) @@ -831,7 +893,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]: @@ -844,7 +910,7 @@ async def get_next(next_link=None): 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( @@ -861,6 +927,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -871,6 +939,7 @@ def prepare_request(next_link=None): 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) @@ -880,6 +949,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -897,7 +967,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]: @@ -910,7 +984,7 @@ async def get_next(next_link=None): 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( @@ -933,6 +1007,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -945,6 +1021,7 @@ def prepare_request(next_link=None): 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) @@ -956,6 +1033,7 @@ def prepare_request(next_link=None): 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) @@ -973,7 +1051,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]: @@ -986,7 +1068,7 @@ async def get_next(next_link=None): 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( self, @@ -1000,17 +1082,24 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1026,7 +1115,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -1057,7 +1146,8 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1068,6 +1158,7 @@ async def begin_power_off( raw_result = await self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1091,10 +1182,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore async def _restart_initial( self, @@ -1108,17 +1198,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -1134,7 +1231,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -1164,7 +1261,8 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1175,6 +1273,7 @@ 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 ) @@ -1198,10 +1297,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore async def _start_initial( self, @@ -1215,17 +1313,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -1241,7 +1346,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1271,7 +1376,8 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1282,6 +1388,7 @@ 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 ) @@ -1305,10 +1412,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore async def _redeploy_initial( self, @@ -1322,17 +1428,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -1348,7 +1461,7 @@ async def _redeploy_initial( return deserialized - _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 @distributed_trace_async @@ -1378,7 +1491,8 @@ async def begin_redeploy( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1389,6 +1503,7 @@ 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 ) @@ -1412,7 +1527,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_availability_sets_operations.py index 0011fab064bc..518661bdfbeb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -145,29 +147,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -177,30 +180,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -211,31 +215,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -288,6 +293,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -296,6 +302,7 @@ def create_or_update( resource_group_name=resource_group_name, name=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'], @@ -303,7 +310,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -317,7 +328,7 @@ def create_or_update( 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 @@ -344,17 +355,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -370,7 +388,7 @@ def delete( return deserialized - 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 @@ -397,17 +415,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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) - 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]: @@ -421,7 +446,7 @@ def get( 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 @@ -438,6 +463,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -448,6 +475,7 @@ def prepare_request(next_link=None): 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) @@ -457,6 +485,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -474,7 +503,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]: @@ -487,7 +520,7 @@ def get_next(next_link=None): 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( @@ -506,6 +539,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -517,6 +552,7 @@ def prepare_request(next_link=None): 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) @@ -527,6 +563,7 @@ def prepare_request(next_link=None): 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) @@ -544,7 +581,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]: @@ -557,7 +598,7 @@ def get_next(next_link=None): 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( @@ -580,6 +621,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -592,6 +635,7 @@ def prepare_request(next_link=None): 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) @@ -603,6 +647,7 @@ def prepare_request(next_link=None): 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) @@ -620,7 +665,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]: @@ -633,4 +682,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_disks_operations.py index 683c26b368db..819a3932efc3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -260,35 +264,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -301,31 +305,32 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -364,6 +369,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -372,6 +378,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -379,7 +386,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -397,7 +408,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -430,8 +441,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -443,6 +455,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -467,10 +480,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -485,6 +497,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -493,6 +506,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -500,7 +514,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -518,7 +536,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -551,8 +569,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -564,6 +583,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -588,10 +608,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -619,17 +638,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -643,7 +669,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _delete_initial( @@ -658,17 +684,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -684,7 +717,7 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -716,7 +749,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -727,6 +761,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -750,10 +785,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -770,6 +804,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -781,6 +817,7 @@ def prepare_request(next_link=None): 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) @@ -791,6 +828,7 @@ def prepare_request(next_link=None): 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) @@ -808,7 +846,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]: @@ -821,7 +863,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -835,6 +877,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -845,6 +889,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -854,6 +899,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -871,7 +917,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]: @@ -884,7 +934,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -899,6 +949,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -907,6 +958,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -914,7 +966,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -930,7 +986,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -964,8 +1020,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -977,6 +1034,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1001,10 +1059,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore def _revoke_access_initial( self, @@ -1018,17 +1075,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1044,7 +1108,7 @@ def _revoke_access_initial( return deserialized - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace @@ -1076,7 +1140,8 @@ def begin_revoke_access( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1087,6 +1152,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1110,7 +1176,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_images_operations.py index 397e4556ca27..a4eec140009c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -79,31 +79,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -116,33 +117,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -152,30 +154,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -184,29 +187,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -245,6 +249,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -253,6 +258,7 @@ def _create_or_update_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'], @@ -260,7 +266,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -278,7 +288,7 @@ def _create_or_update_initial( 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 @@ -309,8 +319,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -322,6 +333,7 @@ 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 @@ -346,10 +358,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _delete_initial( self, @@ -363,17 +374,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -389,7 +407,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -419,7 +437,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -430,6 +449,7 @@ 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 ) @@ -453,10 +473,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -472,7 +491,7 @@ 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) @@ -485,18 +504,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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) - 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]: @@ -510,7 +536,7 @@ def get( 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 @@ -529,6 +555,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -540,6 +568,7 @@ def prepare_request(next_link=None): 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) @@ -550,6 +579,7 @@ def prepare_request(next_link=None): 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) @@ -567,7 +597,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]: @@ -580,7 +614,7 @@ def get_next(next_link=None): 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( @@ -596,6 +630,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -606,6 +642,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -615,6 +652,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -632,7 +670,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]: @@ -645,4 +687,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_snapshots_operations.py index a4156d06979c..c8f68a50e080 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -260,35 +264,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -301,31 +305,32 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -364,6 +369,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -372,6 +378,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -379,7 +386,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -397,7 +408,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -429,8 +440,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,6 +454,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -466,10 +479,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -484,6 +496,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -492,6 +505,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -499,7 +513,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -517,7 +535,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -549,8 +567,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -562,6 +581,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -586,10 +606,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -616,17 +635,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -640,7 +666,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _delete_initial( @@ -655,17 +681,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -681,7 +714,7 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -712,7 +745,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -723,6 +757,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -746,10 +781,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -767,6 +801,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -778,6 +814,7 @@ def prepare_request(next_link=None): 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) @@ -788,6 +825,7 @@ def prepare_request(next_link=None): 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) @@ -805,7 +843,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]: @@ -818,7 +860,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -833,6 +875,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -843,6 +887,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -852,6 +897,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -869,7 +915,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]: @@ -882,7 +932,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -897,6 +947,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -905,6 +956,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -912,7 +964,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -928,7 +984,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -961,8 +1017,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -974,6 +1031,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -998,10 +1056,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore def _revoke_access_initial( self, @@ -1015,17 +1072,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1041,7 +1105,7 @@ def _revoke_access_initial( return deserialized - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace @@ -1072,7 +1136,8 @@ def begin_revoke_access( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1083,6 +1148,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1106,7 +1172,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_usage_operations.py index 5a5218ab7fc0..e7bacf88c419 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,6 +98,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -108,6 +111,7 @@ def prepare_request(next_link=None): 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) @@ -118,6 +122,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -135,7 +140,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]: @@ -148,4 +157,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extension_images_operations.py index a84f55334383..76731d92c0ad 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extensions_operations.py index bdcc9922bdb3..729e2b1bc7ec 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,10 +127,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -138,21 +139,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,10 +167,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -177,23 +179,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -233,6 +235,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -242,6 +245,7 @@ def _create_or_update_initial( 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'], @@ -249,7 +253,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -267,7 +275,7 @@ def _create_or_update_initial( 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 @@ -306,8 +314,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -320,6 +329,7 @@ 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 @@ -344,10 +354,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -363,6 +372,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -372,6 +382,7 @@ def _update_initial( 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'], @@ -379,7 +390,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -393,7 +408,7 @@ def _update_initial( 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 @@ -431,8 +446,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -445,6 +461,7 @@ 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 @@ -469,10 +486,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _delete_initial( self, @@ -487,18 +503,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -514,7 +537,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -547,7 +570,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -559,6 +583,7 @@ 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 ) @@ -582,10 +607,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -604,7 +628,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) @@ -617,19 +641,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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) - 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]: @@ -643,5 +674,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_images_operations.py index eb1a7b0ec846..16fc4c634496 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_set_vms_operations.py index 28de0abbf1ec..7af2439ab5ca 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_reimage_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -46,21 +47,21 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,10 +73,11 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -83,21 +85,21 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -109,10 +111,11 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -120,21 +123,21 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -146,10 +149,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -157,21 +161,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,10 +187,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -194,21 +199,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -220,10 +225,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + _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'), @@ -231,21 +237,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -260,37 +266,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -302,10 +309,11 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -313,21 +321,21 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -339,10 +347,11 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -350,21 +359,21 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -376,10 +385,11 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -387,21 +397,21 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -440,18 +450,25 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -467,7 +484,7 @@ def _reimage_initial( return deserialized - _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 @distributed_trace @@ -500,7 +517,8 @@ def begin_reimage( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -512,6 +530,7 @@ def begin_reimage( 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 ) @@ -535,10 +554,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore def _reimage_all_initial( self, @@ -553,18 +571,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -580,7 +605,7 @@ def _reimage_all_initial( return deserialized - _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 @distributed_trace @@ -614,7 +639,8 @@ def begin_reimage_all( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -626,6 +652,7 @@ 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 ) @@ -649,10 +676,9 @@ 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) + 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 + begin_reimage_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall"} # type: ignore def _deallocate_initial( self, @@ -667,18 +693,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -694,7 +727,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -729,7 +762,8 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -741,6 +775,7 @@ 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 ) @@ -764,10 +799,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _delete_initial( self, @@ -782,18 +816,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -809,7 +850,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -842,7 +883,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -854,6 +896,7 @@ def begin_delete( 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 ) @@ -877,10 +920,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -909,18 +951,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -934,7 +983,7 @@ def get( 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 @@ -964,18 +1013,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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) - 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]: @@ -989,7 +1045,7 @@ def get_instance_view( 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 @@ -1008,11 +1064,11 @@ def list( :type resource_group_name: str :param virtual_machine_scale_set_name: The name of the VM scale set. :type virtual_machine_scale_set_name: str - :param filter: The filter to apply to the operation. + :param filter: The filter to apply to the operation. Default value is None. :type filter: str - :param select: The list parameters. + :param select: The list parameters. Default value is None. :type select: str - :param expand: The expand expression to apply to the operation. + :param expand: The expand expression to apply to 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 VirtualMachineScaleSetVMListResult or the result @@ -1021,6 +1077,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1033,6 +1091,7 @@ def prepare_request(next_link=None): 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, @@ -1047,6 +1106,7 @@ def prepare_request(next_link=None): 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, @@ -1067,7 +1127,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]: @@ -1080,7 +1144,7 @@ def get_next(next_link=None): 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( self, @@ -1095,18 +1159,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1122,7 +1193,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1157,7 +1228,8 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1169,6 +1241,7 @@ def begin_power_off( 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 ) @@ -1192,10 +1265,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore def _restart_initial( self, @@ -1210,18 +1282,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1237,7 +1316,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1270,7 +1349,8 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1282,6 +1362,7 @@ 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 ) @@ -1305,10 +1386,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore def _start_initial( self, @@ -1323,18 +1403,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1350,7 +1437,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1383,7 +1470,8 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1395,6 +1483,7 @@ 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 ) @@ -1418,7 +1507,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_sets_operations.py index 5689cdaa4e78..d6861be7b29b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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("name", name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -79,31 +79,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -114,31 +115,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -152,35 +154,35 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -196,35 +198,35 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -237,31 +239,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -271,30 +274,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -303,29 +307,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -336,31 +341,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -374,35 +380,35 @@ def build_power_off_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -418,35 +424,35 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -462,35 +468,35 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -506,35 +512,35 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -547,31 +553,32 @@ def build_reimage_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -582,35 +589,36 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -645,6 +653,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -653,6 +662,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, name=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'], @@ -660,7 +670,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -678,7 +692,7 @@ def _create_or_update_initial( 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 @@ -711,8 +725,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -724,6 +739,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -748,10 +764,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _delete_initial( self, @@ -765,17 +780,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -791,7 +813,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -821,7 +843,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -832,6 +855,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -855,10 +879,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -884,17 +907,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -908,7 +938,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _deallocate_initial( @@ -924,6 +954,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -935,6 +966,7 @@ def _deallocate_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'], @@ -942,7 +974,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -958,7 +994,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -977,7 +1013,8 @@ 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. + :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -994,8 +1031,9 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1007,6 +1045,7 @@ 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 @@ -1031,10 +1070,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore def _delete_instances_initial( self, @@ -1049,6 +1087,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1057,6 +1096,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1064,7 +1104,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1080,7 +1124,7 @@ def _delete_instances_initial( return deserialized - _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 @distributed_trace @@ -1114,8 +1158,9 @@ def begin_delete_instances( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1127,6 +1172,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1151,10 +1197,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1180,17 +1225,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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) - 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]: @@ -1204,7 +1256,7 @@ def get_instance_view( 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 @@ -1224,6 +1276,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1235,6 +1289,7 @@ def prepare_request(next_link=None): 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) @@ -1245,6 +1300,7 @@ def prepare_request(next_link=None): 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) @@ -1262,7 +1318,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]: @@ -1275,7 +1335,7 @@ def get_next(next_link=None): 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( @@ -1293,6 +1353,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1303,6 +1365,7 @@ def prepare_request(next_link=None): 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) @@ -1312,6 +1375,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1329,7 +1393,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]: @@ -1342,7 +1410,7 @@ def get_next(next_link=None): 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( @@ -1365,6 +1433,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1377,6 +1447,7 @@ def prepare_request(next_link=None): 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) @@ -1388,6 +1459,7 @@ def prepare_request(next_link=None): 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) @@ -1405,7 +1477,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]: @@ -1418,7 +1494,7 @@ def get_next(next_link=None): 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 def _power_off_initial( self, @@ -1433,6 +1509,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1444,6 +1521,7 @@ def _power_off_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._power_off_initial.metadata['url'], @@ -1451,7 +1529,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1467,7 +1549,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1486,7 +1568,8 @@ def begin_power_off( :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. + :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1503,8 +1586,9 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1516,6 +1600,7 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1540,10 +1625,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore def _restart_initial( self, @@ -1558,6 +1642,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1569,6 +1654,7 @@ def _restart_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'], @@ -1576,7 +1662,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1592,7 +1682,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1609,7 +1699,8 @@ 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. + :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1626,8 +1717,9 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1639,6 +1731,7 @@ 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 @@ -1663,10 +1756,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore def _start_initial( self, @@ -1681,6 +1773,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1692,6 +1785,7 @@ def _start_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'], @@ -1699,7 +1793,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1715,7 +1813,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1732,7 +1830,8 @@ 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. + :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.v2016_04_30_preview.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1749,8 +1848,9 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1762,6 +1862,7 @@ 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 @@ -1786,10 +1887,9 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore def _update_instances_initial( self, @@ -1804,6 +1904,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1812,6 +1913,7 @@ def _update_instances_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'], @@ -1819,7 +1921,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1835,7 +1941,7 @@ def _update_instances_initial( return deserialized - _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 @distributed_trace @@ -1869,8 +1975,9 @@ def begin_update_instances( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1882,6 +1989,7 @@ 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 @@ -1906,10 +2014,9 @@ 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) + 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 + begin_update_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore def _reimage_initial( self, @@ -1923,17 +2030,24 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1949,7 +2063,7 @@ def _reimage_initial( return deserialized - _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 @distributed_trace @@ -1979,7 +2093,8 @@ def begin_reimage( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1990,6 +2105,7 @@ def begin_reimage( raw_result = self._reimage_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 ) @@ -2013,10 +2129,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore def _reimage_all_initial( self, @@ -2030,17 +2145,24 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -2056,7 +2178,7 @@ def _reimage_all_initial( return deserialized - _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 @distributed_trace @@ -2087,7 +2209,8 @@ def begin_reimage_all( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2098,6 +2221,7 @@ def begin_reimage_all( raw_result = self._reimage_all_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 ) @@ -2121,7 +2245,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) + 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 + begin_reimage_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_sizes_operations.py index 5d976b48f56f..aab0aac6e81e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,6 +98,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -108,6 +111,7 @@ def prepare_request(next_link=None): 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) @@ -118,6 +122,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -135,7 +140,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]: @@ -148,4 +157,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machines_operations.py index b1d556fff6cc..0e94d7897290 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,33 +37,34 @@ def build_get_extensions_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -77,35 +78,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,35 +122,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2016-04-30-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -162,31 +163,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,33 +201,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -236,31 +239,32 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -271,31 +275,32 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -306,31 +311,32 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -340,30 +346,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -372,29 +379,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -405,31 +413,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -440,31 +449,32 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -475,31 +485,32 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -510,31 +521,32 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -545,35 +557,36 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2016-04-30-preview" + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -609,7 +622,7 @@ def get_extensions( :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) @@ -622,18 +635,25 @@ def get_extensions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_get_extensions_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_extensions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -647,7 +667,7 @@ def get_extensions( return deserialized - get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + get_extensions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore def _capture_initial( @@ -663,6 +683,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -671,6 +692,7 @@ def _capture_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'], @@ -678,7 +700,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -694,7 +720,7 @@ def _capture_initial( 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 @@ -729,8 +755,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -742,6 +769,7 @@ 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 @@ -766,10 +794,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -784,6 +811,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -792,6 +820,7 @@ def _create_or_update_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'], @@ -799,7 +828,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -817,7 +850,7 @@ def _create_or_update_initial( 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 @@ -850,8 +883,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -863,6 +897,7 @@ 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 @@ -887,10 +922,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _delete_initial( self, @@ -904,17 +938,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -930,7 +971,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -960,7 +1001,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -971,6 +1013,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -994,10 +1037,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1013,8 +1055,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1027,18 +1069,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: 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) - 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]: @@ -1052,7 +1101,7 @@ def get( 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 def _convert_to_managed_disks_initial( @@ -1067,17 +1116,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1093,7 +1149,7 @@ def _convert_to_managed_disks_initial( return deserialized - _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 @distributed_trace @@ -1124,7 +1180,8 @@ def begin_convert_to_managed_disks( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1135,6 +1192,7 @@ 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 ) @@ -1158,10 +1216,9 @@ 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) + 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 + begin_convert_to_managed_disks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks"} # type: ignore def _deallocate_initial( self, @@ -1175,17 +1232,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1201,7 +1265,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -1232,7 +1296,8 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1243,6 +1308,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1266,10 +1332,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace def generalize( @@ -1295,17 +1360,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -1319,7 +1391,7 @@ def generalize( return deserialized - 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 @@ -1340,6 +1412,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1351,6 +1425,7 @@ def prepare_request(next_link=None): 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) @@ -1361,6 +1436,7 @@ def prepare_request(next_link=None): 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) @@ -1378,7 +1454,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]: @@ -1391,7 +1471,7 @@ def get_next(next_link=None): 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( @@ -1408,6 +1488,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1418,6 +1500,7 @@ def prepare_request(next_link=None): 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) @@ -1427,6 +1510,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1444,7 +1528,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]: @@ -1457,7 +1545,7 @@ def get_next(next_link=None): 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( @@ -1480,6 +1568,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2016_04_30_preview.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1492,6 +1582,7 @@ def prepare_request(next_link=None): 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) @@ -1503,6 +1594,7 @@ def prepare_request(next_link=None): 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) @@ -1520,7 +1612,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]: @@ -1533,7 +1629,7 @@ def get_next(next_link=None): 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( self, @@ -1547,17 +1643,24 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1573,7 +1676,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1604,7 +1707,8 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1615,6 +1719,7 @@ def begin_power_off( raw_result = self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1638,10 +1743,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore def _restart_initial( self, @@ -1655,17 +1759,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -1681,7 +1792,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1711,7 +1822,8 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1722,6 +1834,7 @@ 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 ) @@ -1745,10 +1858,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore def _start_initial( self, @@ -1762,17 +1874,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -1788,7 +1907,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1818,7 +1937,8 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1829,6 +1949,7 @@ 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 ) @@ -1852,10 +1973,9 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore def _redeploy_initial( self, @@ -1869,17 +1989,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + 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) - 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]: @@ -1895,7 +2022,7 @@ def _redeploy_initial( return deserialized - _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 @distributed_trace @@ -1925,7 +2052,8 @@ def begin_redeploy( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2016_04_30_preview.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2016-04-30-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1936,6 +2064,7 @@ 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 ) @@ -1959,7 +2088,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py index 15ace3cb5f83..9c43111790ab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations @@ -73,8 +74,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-03-30". 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. """ @@ -113,7 +117,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_configuration.py index cc900f349a5c..7dafe7d949e2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2017-03-30". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-03-30" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json index f9c34aaa1b6d..44dddee6f760 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py index 604f13d25c01..53277b921951 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar availability_sets: AvailabilitySetsOperations operations @@ -74,8 +75,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-03-30". 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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_configuration.py index 0a910c71608e..853e8aea0afd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/_configuration.py @@ -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 "2017-03-30". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-03-30" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_availability_sets_operations.py index fbdd83d67dff..0062a3d6da30 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -129,17 +134,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -155,7 +167,7 @@ async def delete( return deserialized - 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 @@ -182,17 +194,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -206,7 +225,7 @@ async def get( 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 @@ -218,7 +237,7 @@ 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 @@ -227,6 +246,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -237,6 +258,7 @@ def prepare_request(next_link=None): 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'], ) @@ -247,6 +269,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -265,7 +288,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]: @@ -278,7 +305,7 @@ async def get_next(next_link=None): 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( @@ -297,6 +324,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -308,6 +337,7 @@ def prepare_request(next_link=None): 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) @@ -318,6 +348,7 @@ def prepare_request(next_link=None): 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) @@ -335,7 +366,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]: @@ -348,7 +383,7 @@ async def get_next(next_link=None): 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( @@ -371,6 +406,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -383,6 +420,7 @@ def prepare_request(next_link=None): 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) @@ -394,6 +432,7 @@ def prepare_request(next_link=None): 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) @@ -411,7 +450,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]: @@ -424,4 +467,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_disks_operations.py index 9ebe2d43b3b4..9aac78f83a5b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,7 +360,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _delete_initial( @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -381,7 +408,7 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -413,7 +440,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -424,6 +452,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -447,10 +476,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -468,6 +496,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -479,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -489,6 +520,7 @@ def prepare_request(next_link=None): 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) @@ -506,7 +538,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]: @@ -519,7 +555,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -534,6 +570,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -544,6 +582,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -553,6 +592,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -570,7 +610,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]: @@ -583,7 +627,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -598,6 +642,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -606,6 +651,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -613,7 +659,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -629,7 +679,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -664,8 +714,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -677,6 +728,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -701,10 +753,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore async def _revoke_access_initial( self, @@ -718,17 +769,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -744,7 +802,7 @@ async def _revoke_access_initial( return deserialized - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async @@ -776,7 +834,8 @@ async def begin_revoke_access( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -787,6 +846,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -810,7 +870,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_images_operations.py index b69fe6eb850a..e372b508ef72 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _delete_initial( self, @@ -179,17 +185,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -205,7 +218,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -235,7 +248,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -246,6 +260,7 @@ 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 ) @@ -269,10 +284,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -288,7 +302,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) @@ -301,18 +315,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -326,7 +347,7 @@ async def get( 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 @@ -345,6 +366,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -356,6 +379,7 @@ def prepare_request(next_link=None): 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) @@ -366,6 +390,7 @@ def prepare_request(next_link=None): 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) @@ -383,7 +408,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]: @@ -396,7 +425,7 @@ async def get_next(next_link=None): 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( @@ -412,6 +441,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -422,6 +453,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -431,6 +463,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -448,7 +481,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]: @@ -461,4 +498,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_resource_skus_operations.py index 1d837535968b..459418aa2881 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_resource_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -59,6 +57,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -78,6 +79,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -95,7 +97,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,4 +114,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_snapshots_operations.py index 27a4eeb21446..0c5059eec696 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,7 +362,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _delete_initial( @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -383,7 +410,7 @@ async def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -415,7 +442,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -426,6 +454,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -449,10 +478,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -470,6 +498,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -481,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -491,6 +522,7 @@ def prepare_request(next_link=None): 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) @@ -508,7 +540,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]: @@ -521,7 +557,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -536,6 +572,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -546,6 +584,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -555,6 +594,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -572,7 +612,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]: @@ -585,7 +629,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -600,6 +644,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -608,6 +653,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -615,7 +661,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -631,7 +681,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -666,8 +716,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -679,6 +730,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -703,10 +755,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore async def _revoke_access_initial( self, @@ -720,17 +771,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -746,7 +804,7 @@ async def _revoke_access_initial( return deserialized - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async @@ -778,7 +836,8 @@ async def begin_revoke_access( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -789,6 +848,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -812,7 +872,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_usage_operations.py index 5c5b43ae1cac..4b1d8ce30254 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extension_images_operations.py index 4bfeab648365..82ad3986ff49 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extensions_operations.py index 9960ef4618f9..d83e94f5694d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,10 +309,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _delete_initial( self, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -340,7 +360,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -373,7 +393,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,6 +406,7 @@ 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 ) @@ -408,10 +430,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -430,7 +451,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) @@ -443,19 +464,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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) - 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]: @@ -469,5 +497,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_images_operations.py index 62c2df6cd0e6..8e3efe0742ca 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_run_commands_operations.py index 49a21b7db76b..d8be7e1bfd9b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,7 +121,7 @@ async def get_next(next_link=None): 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( @@ -140,17 +147,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -164,5 +178,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 5dab570b257f..ee4e11b5a752 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore async def _delete_initial( self, @@ -191,18 +197,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,7 +231,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -251,7 +264,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +277,7 @@ 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 ) @@ -286,10 +301,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -308,7 +322,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) @@ -321,19 +335,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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) - 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]: @@ -347,7 +368,7 @@ async def get( 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 @@ -370,6 +391,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -382,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -393,6 +417,7 @@ def prepare_request(next_link=None): 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) @@ -410,7 +435,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]: @@ -423,4 +452,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 1c7f6998a96b..545fefa0e3ee 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -84,7 +90,7 @@ async def _cancel_initial( return deserialized - _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 @distributed_trace_async @@ -114,7 +120,8 @@ async def begin_cancel( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -125,6 +132,7 @@ 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 ) @@ -148,10 +156,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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore async def _start_os_upgrade_initial( self, @@ -165,17 +172,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -191,7 +205,7 @@ async def _start_os_upgrade_initial( return deserialized - _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 @distributed_trace_async @@ -223,7 +237,8 @@ async def begin_start_os_upgrade( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -234,6 +249,7 @@ 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 ) @@ -257,10 +273,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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore @distributed_trace_async async def get_latest( @@ -286,17 +301,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -310,5 +332,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py index f7050c704458..a88e985ee921 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,18 +60,25 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -88,7 +94,7 @@ async def _reimage_initial( return deserialized - _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 @distributed_trace_async @@ -121,7 +127,8 @@ async def begin_reimage( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -133,6 +140,7 @@ async def begin_reimage( 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 ) @@ -156,10 +164,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore async def _reimage_all_initial( self, @@ -174,18 +181,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -201,7 +215,7 @@ async def _reimage_all_initial( return deserialized - _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 @distributed_trace_async @@ -235,7 +249,8 @@ async def begin_reimage_all( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -247,6 +262,7 @@ 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 ) @@ -270,10 +286,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) + 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 + begin_reimage_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall"} # type: ignore async def _deallocate_initial( self, @@ -288,18 +303,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -315,7 +337,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -350,7 +372,8 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -362,6 +385,7 @@ 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 ) @@ -385,10 +409,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _delete_initial( self, @@ -403,18 +426,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -430,7 +460,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -463,7 +493,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -475,6 +506,7 @@ async def begin_delete( 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 ) @@ -498,10 +530,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -530,18 +561,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -555,7 +593,7 @@ async def get( 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 @@ -585,18 +623,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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 +655,7 @@ async def get_instance_view( 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 @@ -631,12 +676,13 @@ 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 @@ -645,6 +691,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -657,6 +705,7 @@ def prepare_request(next_link=None): 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, @@ -671,6 +720,7 @@ def prepare_request(next_link=None): 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, @@ -691,7 +741,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]: @@ -704,7 +758,7 @@ async def get_next(next_link=None): 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( self, @@ -719,18 +773,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -746,7 +807,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -781,7 +842,8 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -793,6 +855,7 @@ async def begin_power_off( 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 ) @@ -816,10 +879,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore async def _restart_initial( self, @@ -834,18 +896,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -861,7 +930,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -894,7 +963,8 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -906,6 +976,7 @@ 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 ) @@ -929,10 +1000,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore async def _start_initial( self, @@ -947,18 +1017,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -974,7 +1051,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1007,7 +1084,8 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1019,6 +1097,7 @@ 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 ) @@ -1042,7 +1121,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_sets_operations.py index 30f178100e93..5d9c230aecfa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -190,6 +197,7 @@ async def _update_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'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -211,7 +223,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,10 +295,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _delete_initial( self, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -324,7 +344,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -354,7 +374,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -365,6 +386,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -388,10 +410,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -417,17 +438,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -441,7 +469,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _deallocate_initial( @@ -457,6 +485,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -468,6 +497,7 @@ async def _deallocate_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'], @@ -475,7 +505,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -491,7 +525,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -510,7 +544,8 @@ 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. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -527,8 +562,9 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -540,6 +576,7 @@ 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 @@ -564,10 +601,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore async def _delete_instances_initial( self, @@ -582,6 +618,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -590,6 +627,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -597,7 +635,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -613,7 +655,7 @@ async def _delete_instances_initial( return deserialized - _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 @distributed_trace_async @@ -647,8 +689,9 @@ async def begin_delete_instances( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -660,6 +703,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -684,10 +728,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) + 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 + 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( @@ -713,17 +756,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -737,7 +787,7 @@ async def get_instance_view( 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 @@ -757,6 +807,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -768,6 +820,7 @@ def prepare_request(next_link=None): 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) @@ -778,6 +831,7 @@ def prepare_request(next_link=None): 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) @@ -795,7 +849,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]: @@ -808,7 +866,7 @@ async def get_next(next_link=None): 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( @@ -826,6 +884,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -836,6 +896,7 @@ def prepare_request(next_link=None): 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) @@ -845,6 +906,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -862,7 +924,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]: @@ -875,7 +941,7 @@ async def get_next(next_link=None): 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( @@ -898,6 +964,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -910,6 +978,7 @@ def prepare_request(next_link=None): 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) @@ -921,6 +990,7 @@ def prepare_request(next_link=None): 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) @@ -938,7 +1008,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]: @@ -951,7 +1025,7 @@ async def get_next(next_link=None): 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 async def _power_off_initial( self, @@ -966,6 +1040,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -977,6 +1052,7 @@ async def _power_off_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._power_off_initial.metadata['url'], @@ -984,7 +1060,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1000,7 +1080,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -1019,7 +1099,8 @@ async def begin_power_off( :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. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1036,8 +1117,9 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1049,6 +1131,7 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1073,10 +1156,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore async def _restart_initial( self, @@ -1091,6 +1173,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1102,6 +1185,7 @@ async def _restart_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'], @@ -1109,7 +1193,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1125,7 +1213,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -1142,7 +1230,8 @@ 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. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1159,8 +1248,9 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1172,6 +1262,7 @@ 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 @@ -1196,10 +1287,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore async def _start_initial( self, @@ -1214,6 +1304,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1225,6 +1316,7 @@ async def _start_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'], @@ -1232,7 +1324,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1248,7 +1344,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1265,7 +1361,8 @@ 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. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1282,8 +1379,9 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1295,6 +1393,7 @@ 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 @@ -1319,10 +1418,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore async def _update_instances_initial( self, @@ -1337,6 +1435,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1345,6 +1444,7 @@ async def _update_instances_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'], @@ -1352,7 +1452,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1368,7 +1472,7 @@ async def _update_instances_initial( return deserialized - _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 @distributed_trace_async @@ -1402,8 +1506,9 @@ async def begin_update_instances( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1415,6 +1520,7 @@ 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 @@ -1439,10 +1545,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) + 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 + begin_update_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore async def _reimage_initial( self, @@ -1457,6 +1562,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1468,6 +1574,7 @@ async def _reimage_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'], @@ -1475,7 +1582,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1491,7 +1602,7 @@ async def _reimage_initial( return deserialized - _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 @distributed_trace_async @@ -1508,7 +1619,8 @@ 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_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1525,8 +1637,9 @@ async def begin_reimage( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1538,6 +1651,7 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1562,10 +1676,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore async def _reimage_all_initial( self, @@ -1580,6 +1693,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1591,6 +1705,7 @@ async def _reimage_all_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'], @@ -1598,7 +1713,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1614,7 +1733,7 @@ async def _reimage_all_initial( return deserialized - _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 @distributed_trace_async @@ -1632,7 +1751,8 @@ 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. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1649,8 +1769,9 @@ async def begin_reimage_all( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1662,6 +1783,7 @@ 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 @@ -1686,7 +1808,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) + 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 + begin_reimage_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_sizes_operations.py index bf1ae395b9fe..b4fcce3c31be 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machines_operations.py index 0517ff41943f..db1f52b054dc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -62,7 +61,7 @@ async def get_extensions( :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) @@ -75,18 +74,25 @@ async def get_extensions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_get_extensions_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_extensions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -100,7 +106,7 @@ async def get_extensions( return deserialized - get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + get_extensions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore @distributed_trace @@ -120,6 +126,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -131,6 +139,7 @@ def prepare_request(next_link=None): 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) @@ -141,6 +150,7 @@ def prepare_request(next_link=None): 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) @@ -158,7 +168,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]: @@ -171,7 +185,7 @@ async def get_next(next_link=None): 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, @@ -186,6 +200,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -194,6 +209,7 @@ async def _capture_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'], @@ -201,7 +217,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -217,7 +237,7 @@ async def _capture_initial( 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 @@ -251,8 +271,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -264,6 +285,7 @@ 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 @@ -288,10 +310,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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -306,6 +327,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -314,6 +336,7 @@ async def _create_or_update_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'], @@ -321,7 +344,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -339,7 +366,7 @@ async def _create_or_update_initial( 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 @@ -372,8 +399,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,6 +413,7 @@ 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 @@ -409,10 +438,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _delete_initial( self, @@ -426,17 +454,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -452,7 +487,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -482,7 +517,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -493,6 +529,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -516,10 +553,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -535,8 +571,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -549,18 +585,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -574,7 +617,7 @@ async def get( 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 @@ -601,17 +644,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -625,7 +675,7 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore async def _convert_to_managed_disks_initial( @@ -640,17 +690,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -666,7 +723,7 @@ async def _convert_to_managed_disks_initial( return deserialized - _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 @distributed_trace_async @@ -697,7 +754,8 @@ async def begin_convert_to_managed_disks( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -708,6 +766,7 @@ 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 ) @@ -731,10 +790,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) + 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 + begin_convert_to_managed_disks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks"} # type: ignore async def _deallocate_initial( self, @@ -748,17 +806,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -774,7 +839,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -805,7 +870,8 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -816,6 +882,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -839,10 +906,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async async def generalize( @@ -868,17 +934,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -892,7 +965,7 @@ async def generalize( return deserialized - 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 @@ -913,6 +986,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -924,6 +999,7 @@ def prepare_request(next_link=None): 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) @@ -934,6 +1010,7 @@ def prepare_request(next_link=None): 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) @@ -951,7 +1028,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]: @@ -964,7 +1045,7 @@ async def get_next(next_link=None): 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( @@ -981,6 +1062,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -991,6 +1074,7 @@ def prepare_request(next_link=None): 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) @@ -1000,6 +1084,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1017,7 +1102,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]: @@ -1030,7 +1119,7 @@ async def get_next(next_link=None): 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( @@ -1053,6 +1142,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1065,6 +1156,7 @@ def prepare_request(next_link=None): 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) @@ -1076,6 +1168,7 @@ def prepare_request(next_link=None): 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) @@ -1093,7 +1186,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]: @@ -1106,7 +1203,7 @@ async def get_next(next_link=None): 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( self, @@ -1120,17 +1217,24 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1146,7 +1250,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -1177,7 +1281,8 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1188,6 +1293,7 @@ async def begin_power_off( raw_result = await self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1211,10 +1317,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore async def _restart_initial( self, @@ -1228,17 +1333,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -1254,7 +1366,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -1284,7 +1396,8 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1295,6 +1408,7 @@ 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 ) @@ -1318,10 +1432,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore async def _start_initial( self, @@ -1335,17 +1448,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -1361,7 +1481,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1391,7 +1511,8 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1402,6 +1523,7 @@ 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 ) @@ -1425,10 +1547,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore async def _redeploy_initial( self, @@ -1442,17 +1563,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -1468,7 +1596,7 @@ async def _redeploy_initial( return deserialized - _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 @distributed_trace_async @@ -1498,7 +1626,8 @@ async def begin_redeploy( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1509,6 +1638,7 @@ 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 ) @@ -1532,10 +1662,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore async def _perform_maintenance_initial( self, @@ -1549,17 +1678,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -1575,7 +1711,7 @@ async def _perform_maintenance_initial( return deserialized - _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 @distributed_trace_async @@ -1605,7 +1741,8 @@ async def begin_perform_maintenance( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1616,6 +1753,7 @@ 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 ) @@ -1639,16 +1777,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # 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"]] @@ -1657,7 +1796,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1665,6 +1804,7 @@ async def _run_command_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'], @@ -1672,7 +1812,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1688,7 +1832,7 @@ async def _run_command_initial( 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 @@ -1697,6 +1841,8 @@ async def begin_run_command( 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. @@ -1707,6 +1853,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2017_03_30.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 @@ -1721,8 +1870,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_03_30.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1735,6 +1884,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1758,7 +1908,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_availability_sets_operations.py index 3a496c5bed48..84a9f8b624f1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -77,31 +77,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -112,31 +113,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -147,31 +149,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -181,30 +184,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,31 +219,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -292,6 +297,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -300,6 +306,7 @@ def create_or_update( 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'], @@ -307,7 +314,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -321,7 +332,7 @@ def create_or_update( 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 @@ -348,17 +359,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -374,7 +392,7 @@ def delete( return deserialized - 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 @@ -401,17 +419,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -425,7 +450,7 @@ def get( 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 @@ -437,7 +462,7 @@ 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 @@ -446,6 +471,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -456,6 +483,7 @@ def prepare_request(next_link=None): 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'], ) @@ -466,6 +494,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -484,7 +513,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]: @@ -497,7 +530,7 @@ def get_next(next_link=None): 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( @@ -516,6 +549,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -527,6 +562,7 @@ def prepare_request(next_link=None): 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) @@ -537,6 +573,7 @@ def prepare_request(next_link=None): 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) @@ -554,7 +591,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]: @@ -567,7 +608,7 @@ def get_next(next_link=None): 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( @@ -590,6 +631,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -602,6 +645,7 @@ def prepare_request(next_link=None): 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) @@ -613,6 +657,7 @@ def prepare_request(next_link=None): 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) @@ -630,7 +675,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]: @@ -643,4 +692,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_disks_operations.py index d7b700f46ca2..d13e576d3c5e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -260,35 +264,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -301,31 +305,32 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -364,6 +369,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -372,6 +378,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -379,7 +386,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -397,7 +408,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -430,8 +441,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -443,6 +455,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -467,10 +480,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -485,6 +497,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -493,6 +506,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -500,7 +514,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -518,7 +536,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -551,8 +569,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -564,6 +583,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -588,10 +608,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -619,17 +638,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -643,7 +669,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _delete_initial( @@ -658,17 +684,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -684,7 +717,7 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -716,7 +749,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -727,6 +761,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -750,10 +785,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -770,6 +804,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -781,6 +817,7 @@ def prepare_request(next_link=None): 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) @@ -791,6 +828,7 @@ def prepare_request(next_link=None): 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) @@ -808,7 +846,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]: @@ -821,7 +863,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -835,6 +877,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -845,6 +889,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -854,6 +899,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -871,7 +917,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]: @@ -884,7 +934,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -899,6 +949,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -907,6 +958,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -914,7 +966,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -930,7 +986,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -964,8 +1020,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -977,6 +1034,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1001,10 +1059,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore def _revoke_access_initial( self, @@ -1018,17 +1075,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1044,7 +1108,7 @@ def _revoke_access_initial( return deserialized - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace @@ -1076,7 +1140,8 @@ def begin_revoke_access( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1087,6 +1152,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1110,7 +1176,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_images_operations.py index b9e8ea3986ef..62dc48021c79 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -79,31 +79,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -116,33 +117,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -152,30 +154,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -184,29 +187,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -245,6 +249,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -253,6 +258,7 @@ def _create_or_update_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'], @@ -260,7 +266,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -278,7 +288,7 @@ def _create_or_update_initial( 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 @@ -309,8 +319,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -322,6 +333,7 @@ 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 @@ -346,10 +358,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _delete_initial( self, @@ -363,17 +374,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -389,7 +407,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -419,7 +437,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -430,6 +449,7 @@ 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 ) @@ -453,10 +473,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -472,7 +491,7 @@ 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) @@ -485,18 +504,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -510,7 +536,7 @@ def get( 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 @@ -528,6 +554,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -539,6 +567,7 @@ def prepare_request(next_link=None): 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) @@ -549,6 +578,7 @@ def prepare_request(next_link=None): 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) @@ -566,7 +596,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 +613,7 @@ def get_next(next_link=None): 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( @@ -594,6 +628,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -604,6 +640,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -613,6 +650,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -630,7 +668,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]: @@ -643,4 +685,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_resource_skus_operations.py index a1d0e0718ab7..b66e208aac2c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_resource_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,29 +30,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -90,6 +91,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -100,6 +103,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -109,6 +113,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -126,7 +131,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]: @@ -139,4 +148,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_snapshots_operations.py index ab9825a0d761..9619dbeca29d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -260,35 +264,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -301,31 +305,32 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -364,6 +369,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -372,6 +378,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -379,7 +386,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -397,7 +408,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -430,8 +441,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -443,6 +455,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -467,10 +480,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -485,6 +497,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -493,6 +506,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -500,7 +514,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -518,7 +536,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -551,8 +569,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -564,6 +583,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -588,10 +608,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -619,17 +638,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -643,7 +669,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _delete_initial( @@ -658,17 +684,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -684,7 +717,7 @@ def _delete_initial( return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -716,7 +749,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -727,6 +761,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -750,10 +785,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -770,6 +804,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -781,6 +817,7 @@ def prepare_request(next_link=None): 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) @@ -791,6 +828,7 @@ def prepare_request(next_link=None): 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) @@ -808,7 +846,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]: @@ -821,7 +863,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -835,6 +877,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -845,6 +889,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -854,6 +899,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -871,7 +917,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]: @@ -884,7 +934,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -899,6 +949,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -907,6 +958,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -914,7 +966,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -930,7 +986,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -964,8 +1020,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -977,6 +1034,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1001,10 +1059,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore def _revoke_access_initial( self, @@ -1018,17 +1075,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1044,7 +1108,7 @@ def _revoke_access_initial( return deserialized - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace @@ -1076,7 +1140,8 @@ def begin_revoke_access( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1087,6 +1152,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1110,7 +1176,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_usage_operations.py index 9a56359f5766..c3519fd67b28 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extension_images_operations.py index 5d12b021f0bd..2763749c693f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # 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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # 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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extensions_operations.py index 8d88002e11ba..5938fd7896ff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,10 +127,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -138,21 +139,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,10 +167,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -177,23 +179,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -233,6 +235,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -242,6 +245,7 @@ def _create_or_update_initial( 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'], @@ -249,7 +253,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -267,7 +275,7 @@ def _create_or_update_initial( 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 @@ -305,8 +313,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -319,6 +328,7 @@ 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 @@ -343,10 +353,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -362,6 +371,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -371,6 +381,7 @@ def _update_initial( 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'], @@ -378,7 +389,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -392,7 +407,7 @@ def _update_initial( 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 @@ -430,8 +445,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -444,6 +460,7 @@ 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 @@ -468,10 +485,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _delete_initial( self, @@ -486,18 +502,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -513,7 +536,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -546,7 +569,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -558,6 +582,7 @@ 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 ) @@ -581,10 +606,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -603,7 +627,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) @@ -616,19 +640,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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) - 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]: @@ -642,5 +673,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_images_operations.py index 49bc127cd63e..f976b5645a60 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # 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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # 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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # 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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_run_commands_operations.py index 323fe24a572d..e258b5a50b29 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -65,31 +66,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -132,6 +134,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -143,6 +147,7 @@ def prepare_request(next_link=None): 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) @@ -153,6 +158,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -170,7 +176,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]: @@ -183,7 +193,7 @@ def get_next(next_link=None): 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( @@ -209,17 +219,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -233,5 +250,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_extensions_operations.py index e4c8b06ef426..c5c143fffbc5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,10 +82,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -93,21 +94,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,10 +122,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -132,23 +134,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -159,31 +161,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -223,6 +226,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -232,6 +236,7 @@ def _create_or_update_initial( 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'], @@ -239,7 +244,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -257,7 +266,7 @@ def _create_or_update_initial( 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 @@ -296,8 +305,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,6 +320,7 @@ 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 @@ -334,10 +345,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore def _delete_initial( self, @@ -352,18 +362,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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,7 +396,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -412,7 +429,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -424,6 +442,7 @@ 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 ) @@ -447,10 +466,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -469,7 +487,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) @@ -482,19 +500,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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) - 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,7 +533,7 @@ def get( 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 @@ -531,6 +556,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -543,6 +570,7 @@ def prepare_request(next_link=None): 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) @@ -554,6 +582,7 @@ def prepare_request(next_link=None): 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) @@ -571,7 +600,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]: @@ -584,4 +617,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 658fc8d20101..47a87d6f8529 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,31 +33,32 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,31 +69,32 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -103,31 +105,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,17 +168,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -191,7 +201,7 @@ def _cancel_initial( return deserialized - _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 @distributed_trace @@ -221,7 +231,8 @@ def begin_cancel( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -232,6 +243,7 @@ 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 ) @@ -255,10 +267,9 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore def _start_os_upgrade_initial( self, @@ -272,17 +283,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,7 +316,7 @@ def _start_os_upgrade_initial( return deserialized - _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 @distributed_trace @@ -330,7 +348,8 @@ def begin_start_os_upgrade( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -341,6 +360,7 @@ 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 ) @@ -364,10 +384,9 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -393,17 +412,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -417,5 +443,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_vms_operations.py index ac2cf9cc2891..a776748f2eae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_reimage_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -46,21 +47,21 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,10 +73,11 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -83,21 +85,21 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -109,10 +111,11 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -120,21 +123,21 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -146,10 +149,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -157,21 +161,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,10 +187,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -194,21 +199,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -220,10 +225,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView') + _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'), @@ -231,21 +237,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -260,37 +266,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -302,10 +309,11 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -313,21 +321,21 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -339,10 +347,11 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -350,21 +359,21 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -376,10 +385,11 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -387,21 +397,21 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -440,18 +450,25 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -467,7 +484,7 @@ def _reimage_initial( return deserialized - _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 @distributed_trace @@ -500,7 +517,8 @@ def begin_reimage( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -512,6 +530,7 @@ def begin_reimage( 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 ) @@ -535,10 +554,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore def _reimage_all_initial( self, @@ -553,18 +571,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -580,7 +605,7 @@ def _reimage_all_initial( return deserialized - _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 @distributed_trace @@ -614,7 +639,8 @@ def begin_reimage_all( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -626,6 +652,7 @@ 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 ) @@ -649,10 +676,9 @@ 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) + 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 + begin_reimage_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall"} # type: ignore def _deallocate_initial( self, @@ -667,18 +693,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -694,7 +727,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -729,7 +762,8 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -741,6 +775,7 @@ 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 ) @@ -764,10 +799,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _delete_initial( self, @@ -782,18 +816,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -809,7 +850,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -842,7 +883,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -854,6 +896,7 @@ def begin_delete( 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 ) @@ -877,10 +920,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -909,18 +951,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -934,7 +983,7 @@ def get( 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 @@ -964,18 +1013,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -989,7 +1045,7 @@ def get_instance_view( 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 @@ -1010,12 +1066,13 @@ 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 @@ -1024,6 +1081,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1036,6 +1095,7 @@ def prepare_request(next_link=None): 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, @@ -1050,6 +1110,7 @@ def prepare_request(next_link=None): 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, @@ -1070,7 +1131,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]: @@ -1083,7 +1148,7 @@ def get_next(next_link=None): 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( self, @@ -1098,18 +1163,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1125,7 +1197,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1160,7 +1232,8 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1172,6 +1245,7 @@ def begin_power_off( 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 ) @@ -1195,10 +1269,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore def _restart_initial( self, @@ -1213,18 +1286,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1240,7 +1320,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1273,7 +1353,8 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1285,6 +1366,7 @@ 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 ) @@ -1308,10 +1390,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore def _start_initial( self, @@ -1326,18 +1407,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1353,7 +1441,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1386,7 +1474,8 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1398,6 +1487,7 @@ 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 ) @@ -1421,7 +1511,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_sets_operations.py index af8937d850a1..526ea8284e2f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,35 +198,35 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -240,35 +242,35 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -281,31 +283,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -315,30 +318,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -347,29 +351,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -380,31 +385,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -418,35 +424,35 @@ def build_power_off_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -462,35 +468,35 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -506,35 +512,35 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -550,35 +556,35 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -594,35 +600,35 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -638,41 +644,41 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -707,6 +713,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -715,6 +722,7 @@ def _create_or_update_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'], @@ -722,7 +730,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -740,7 +752,7 @@ def _create_or_update_initial( 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 @@ -773,8 +785,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -786,6 +799,7 @@ 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 @@ -810,10 +824,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -828,6 +841,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -836,6 +850,7 @@ def _update_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'], @@ -843,7 +858,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -857,7 +876,7 @@ def _update_initial( 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 @@ -890,8 +909,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -903,6 +923,7 @@ 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 @@ -927,10 +948,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _delete_initial( self, @@ -944,17 +964,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -970,7 +997,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -1000,7 +1027,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1011,6 +1039,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -1034,10 +1063,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1063,17 +1091,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1087,7 +1122,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _deallocate_initial( @@ -1103,6 +1138,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1114,6 +1150,7 @@ def _deallocate_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'], @@ -1121,7 +1158,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1137,7 +1178,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -1156,7 +1197,8 @@ 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. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1173,8 +1215,9 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1186,6 +1229,7 @@ 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 @@ -1210,10 +1254,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore def _delete_instances_initial( self, @@ -1228,6 +1271,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1236,6 +1280,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1243,7 +1288,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1259,7 +1308,7 @@ def _delete_instances_initial( return deserialized - _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 @distributed_trace @@ -1293,8 +1342,9 @@ def begin_delete_instances( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1306,6 +1356,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1330,10 +1381,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1359,17 +1409,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -1383,7 +1440,7 @@ def get_instance_view( 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 @@ -1403,6 +1460,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1414,6 +1473,7 @@ def prepare_request(next_link=None): 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) @@ -1424,6 +1484,7 @@ def prepare_request(next_link=None): 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) @@ -1441,7 +1502,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]: @@ -1454,7 +1519,7 @@ def get_next(next_link=None): 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( @@ -1472,6 +1537,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1482,6 +1549,7 @@ def prepare_request(next_link=None): 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) @@ -1491,6 +1559,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1508,7 +1577,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]: @@ -1521,7 +1594,7 @@ def get_next(next_link=None): 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( @@ -1544,6 +1617,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1556,6 +1631,7 @@ def prepare_request(next_link=None): 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) @@ -1567,6 +1643,7 @@ def prepare_request(next_link=None): 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) @@ -1584,7 +1661,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]: @@ -1597,7 +1678,7 @@ def get_next(next_link=None): 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 def _power_off_initial( self, @@ -1612,6 +1693,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1623,6 +1705,7 @@ def _power_off_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._power_off_initial.metadata['url'], @@ -1630,7 +1713,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1646,7 +1733,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1665,7 +1752,8 @@ def begin_power_off( :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. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1682,8 +1770,9 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1695,6 +1784,7 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1719,10 +1809,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore def _restart_initial( self, @@ -1737,6 +1826,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1748,6 +1838,7 @@ def _restart_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'], @@ -1755,7 +1846,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1771,7 +1866,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1788,7 +1883,8 @@ 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. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1805,8 +1901,9 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1818,6 +1915,7 @@ 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 @@ -1842,10 +1940,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore def _start_initial( self, @@ -1860,6 +1957,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1871,6 +1969,7 @@ def _start_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'], @@ -1878,7 +1977,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1894,7 +1997,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1911,7 +2014,8 @@ 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. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1928,8 +2032,9 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1941,6 +2046,7 @@ 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 @@ -1965,10 +2071,9 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore def _update_instances_initial( self, @@ -1983,6 +2088,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1991,6 +2097,7 @@ def _update_instances_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'], @@ -1998,7 +2105,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2014,7 +2125,7 @@ def _update_instances_initial( return deserialized - _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 @distributed_trace @@ -2048,8 +2159,9 @@ def begin_update_instances( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2061,6 +2173,7 @@ 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 @@ -2085,10 +2198,9 @@ 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) + 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 + begin_update_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore def _reimage_initial( self, @@ -2103,6 +2215,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2114,6 +2227,7 @@ def _reimage_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'], @@ -2121,7 +2235,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2137,7 +2255,7 @@ def _reimage_initial( return deserialized - _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 @distributed_trace @@ -2154,7 +2272,8 @@ 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_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2171,8 +2290,9 @@ def begin_reimage( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2184,6 +2304,7 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -2208,10 +2329,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore def _reimage_all_initial( self, @@ -2226,6 +2346,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2237,6 +2358,7 @@ def _reimage_all_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'], @@ -2244,7 +2366,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2260,7 +2386,7 @@ def _reimage_all_initial( return deserialized - _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 @distributed_trace @@ -2278,7 +2404,8 @@ 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. + :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.v2017_03_30.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2295,8 +2422,9 @@ def begin_reimage_all( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2308,6 +2436,7 @@ 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 @@ -2332,7 +2461,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) + 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 + begin_reimage_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_sizes_operations.py index 8f0b16152f67..679b1613a89f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,6 +98,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -108,6 +111,7 @@ def prepare_request(next_link=None): 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) @@ -118,6 +122,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -135,7 +140,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]: @@ -148,4 +157,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machines_operations.py index 575000f596b0..568588e95290 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,33 +37,34 @@ def build_get_extensions_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -73,30 +74,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,35 +112,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -154,35 +156,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -195,31 +197,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -232,33 +235,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -269,31 +273,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -304,31 +309,32 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -339,31 +345,32 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -374,31 +381,32 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -408,30 +416,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -440,29 +449,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -473,31 +483,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -508,31 +519,32 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -543,31 +555,32 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -578,31 +591,32 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -613,31 +627,32 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -648,31 +663,32 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-03-30" + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -686,41 +702,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-03-30" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -756,7 +772,7 @@ def get_extensions( :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) @@ -769,18 +785,25 @@ def get_extensions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_get_extensions_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_extensions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -794,7 +817,7 @@ def get_extensions( return deserialized - get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + get_extensions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore @distributed_trace @@ -814,6 +837,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -825,6 +850,7 @@ def prepare_request(next_link=None): 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) @@ -835,6 +861,7 @@ def prepare_request(next_link=None): 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) @@ -852,7 +879,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]: @@ -865,7 +896,7 @@ def get_next(next_link=None): 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, @@ -880,6 +911,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -888,6 +920,7 @@ def _capture_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'], @@ -895,7 +928,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -911,7 +948,7 @@ def _capture_initial( 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 @@ -945,8 +982,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -958,6 +996,7 @@ 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 @@ -982,10 +1021,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -1000,6 +1038,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -1008,6 +1047,7 @@ def _create_or_update_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'], @@ -1015,7 +1055,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1033,7 +1077,7 @@ def _create_or_update_initial( 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 @@ -1065,8 +1109,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1078,6 +1123,7 @@ 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 @@ -1102,10 +1148,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _delete_initial( self, @@ -1119,17 +1164,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1145,7 +1197,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -1175,7 +1227,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1186,6 +1239,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1209,10 +1263,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1228,8 +1281,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1242,18 +1295,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -1267,7 +1327,7 @@ def get( 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 @@ -1294,17 +1354,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: 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) - 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]: @@ -1318,7 +1385,7 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore def _convert_to_managed_disks_initial( @@ -1333,17 +1400,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1359,7 +1433,7 @@ def _convert_to_managed_disks_initial( return deserialized - _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 @distributed_trace @@ -1390,7 +1464,8 @@ def begin_convert_to_managed_disks( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1401,6 +1476,7 @@ 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 ) @@ -1424,10 +1500,9 @@ 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) + 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 + begin_convert_to_managed_disks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks"} # type: ignore def _deallocate_initial( self, @@ -1441,17 +1516,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1467,7 +1549,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -1498,7 +1580,8 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1509,6 +1592,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1532,10 +1616,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace def generalize( @@ -1561,17 +1644,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -1585,7 +1675,7 @@ def generalize( return deserialized - 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 @@ -1606,6 +1696,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1617,6 +1709,7 @@ def prepare_request(next_link=None): 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) @@ -1627,6 +1720,7 @@ def prepare_request(next_link=None): 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) @@ -1644,7 +1738,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]: @@ -1657,7 +1755,7 @@ def get_next(next_link=None): 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( @@ -1674,6 +1772,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1684,6 +1784,7 @@ def prepare_request(next_link=None): 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) @@ -1693,6 +1794,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1710,7 +1812,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]: @@ -1723,7 +1829,7 @@ def get_next(next_link=None): 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( @@ -1746,6 +1852,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_03_30.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1758,6 +1866,7 @@ def prepare_request(next_link=None): 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) @@ -1769,6 +1878,7 @@ def prepare_request(next_link=None): 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) @@ -1786,7 +1896,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]: @@ -1799,7 +1913,7 @@ def get_next(next_link=None): 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( self, @@ -1813,17 +1927,24 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1839,7 +1960,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1870,7 +1991,8 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1881,6 +2003,7 @@ def begin_power_off( raw_result = self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1904,10 +2027,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore def _restart_initial( self, @@ -1921,17 +2043,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -1947,7 +2076,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1977,7 +2106,8 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1988,6 +2118,7 @@ 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 ) @@ -2011,10 +2142,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore def _start_initial( self, @@ -2028,17 +2158,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -2054,7 +2191,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -2084,7 +2221,8 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2095,6 +2233,7 @@ 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 ) @@ -2118,10 +2257,9 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore def _redeploy_initial( self, @@ -2135,17 +2273,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -2161,7 +2306,7 @@ def _redeploy_initial( return deserialized - _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 @distributed_trace @@ -2191,7 +2336,8 @@ def begin_redeploy( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2202,6 +2348,7 @@ 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 ) @@ -2225,10 +2372,9 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore def _perform_maintenance_initial( self, @@ -2242,17 +2388,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + 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) - 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]: @@ -2268,7 +2421,7 @@ def _perform_maintenance_initial( return deserialized - _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 @distributed_trace @@ -2298,7 +2451,8 @@ def begin_perform_maintenance( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2309,6 +2463,7 @@ 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 ) @@ -2332,16 +2487,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore def _run_command_initial( self, resource_group_name: 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"]] @@ -2350,7 +2506,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2358,6 +2514,7 @@ def _run_command_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'], @@ -2365,7 +2522,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2381,7 +2542,7 @@ def _run_command_initial( 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 @@ -2390,6 +2551,8 @@ def begin_run_command( 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. @@ -2400,6 +2563,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2017_03_30.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 @@ -2413,8 +2579,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_03_30.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-03-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2427,6 +2593,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2450,7 +2617,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py index f4d4c04f95d6..8eb3d72f6818 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -31,8 +32,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -54,7 +58,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_configuration.py index dff37dad0a4d..93d9e67413fe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2017-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-09-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-09-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json index 569dfc47a9c2..77e031a2ee2d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py index 9b21baaf164a..1ea7644a0fb2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -31,8 +32,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_configuration.py index eacf3261d083..e93489b321d9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/_configuration.py @@ -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 "2017-09-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-09-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-09-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_resource_skus_operations.py index 14c1d8187fa0..84ad3e90f706 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/aio/operations/_resource_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -59,6 +57,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_09_01.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -78,6 +79,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -95,7 +97,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,4 +114,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_resource_skus_operations.py index 0ae9d6663016..86084c98e256 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_09_01/operations/_resource_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,29 +30,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-09-01" + api_version = kwargs.pop('api_version', "2017-09-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -90,6 +91,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_09_01.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-09-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -100,6 +103,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -109,6 +113,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -126,7 +131,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]: @@ -139,4 +148,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py index f10a207f43d7..4c90377d59f7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -71,8 +72,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-12-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. """ @@ -110,7 +114,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_configuration.py index bee35a9c13f3..e4873372c0d8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2017-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-12-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json index f89b8664b59e..11f84e7ab7be 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py index ad9f599c2336..0e2d7fb9e709 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -72,8 +73,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2017-12-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_configuration.py index 294ade60f400..8345803f9ef5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/_configuration.py @@ -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 "2017-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2017-12-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_availability_sets_operations.py index dfeec6d99aae..4eb935b332cd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,7 +172,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -214,7 +232,7 @@ async def delete( return deserialized - 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 @@ -241,17 +259,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -265,7 +290,7 @@ async def get( 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 @@ -277,7 +302,7 @@ 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 @@ -286,6 +311,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -296,6 +323,7 @@ def prepare_request(next_link=None): 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'], ) @@ -306,6 +334,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -324,7 +353,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]: @@ -337,7 +370,7 @@ async def get_next(next_link=None): 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( @@ -356,6 +389,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -367,6 +402,7 @@ def prepare_request(next_link=None): 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) @@ -377,6 +413,7 @@ def prepare_request(next_link=None): 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) @@ -394,7 +431,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]: @@ -407,7 +448,7 @@ async def get_next(next_link=None): 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( @@ -430,6 +471,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -442,6 +485,7 @@ def prepare_request(next_link=None): 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) @@ -453,6 +497,7 @@ def prepare_request(next_link=None): 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) @@ -470,7 +515,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]: @@ -483,4 +532,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_images_operations.py index 81472a9e8956..e7587f967d88 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,10 +295,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _delete_initial( self, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -324,7 +344,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -354,7 +374,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -365,6 +386,7 @@ 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 ) @@ -388,10 +410,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -407,7 +428,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) @@ -420,18 +441,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -445,7 +473,7 @@ async def get( 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 @@ -464,6 +492,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -475,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -485,6 +516,7 @@ def prepare_request(next_link=None): 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) @@ -502,7 +534,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]: @@ -515,7 +551,7 @@ async def get_next(next_link=None): 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( @@ -531,6 +567,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -541,6 +579,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -550,6 +589,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -567,7 +607,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]: @@ -580,4 +624,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_log_analytics_operations.py index bdecf96b05f1..b3808137c9b2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py index 963bc2b683d3..4014ccda48d2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_usage_operations.py index a324c5e269d7..b665d9fe2f87 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extension_images_operations.py index 5a3df28e3470..12e383939eda 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extensions_operations.py index fab29e63b43e..d5365664aa83 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,10 +309,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _delete_initial( self, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -340,7 +360,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -373,7 +393,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,6 +406,7 @@ 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 ) @@ -408,10 +430,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -430,7 +451,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) @@ -443,19 +464,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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) - 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]: @@ -469,5 +497,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_images_operations.py index 5b816bf88ca1..2d230b4c2550 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_run_commands_operations.py index e150368883f0..ca77d56c73dd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,7 +121,7 @@ async def get_next(next_link=None): 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( @@ -140,17 +147,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -164,5 +178,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index a9538a2d0faa..0d45a4ad37bf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore async def _delete_initial( self, @@ -191,18 +197,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,7 +231,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -251,7 +264,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +277,7 @@ 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 ) @@ -286,10 +301,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -308,7 +322,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) @@ -321,19 +335,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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) - 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]: @@ -347,7 +368,7 @@ async def get( 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 @@ -370,6 +391,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -382,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -393,6 +417,7 @@ def prepare_request(next_link=None): 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) @@ -410,7 +435,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]: @@ -423,4 +452,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 1e34e7a640b8..a6bda7165f4c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -84,7 +90,7 @@ async def _cancel_initial( return deserialized - _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 @distributed_trace_async @@ -114,7 +120,8 @@ async def begin_cancel( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -125,6 +132,7 @@ 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 ) @@ -148,10 +156,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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore async def _start_os_upgrade_initial( self, @@ -165,17 +172,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -191,7 +205,7 @@ async def _start_os_upgrade_initial( return deserialized - _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 @distributed_trace_async @@ -223,7 +237,8 @@ async def begin_start_os_upgrade( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -234,6 +249,7 @@ 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 ) @@ -257,10 +273,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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore @distributed_trace_async async def get_latest( @@ -286,17 +301,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -310,5 +332,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index b0c26623dfe7..153345eb0e5b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,18 +60,25 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -88,7 +94,7 @@ async def _reimage_initial( return deserialized - _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 @distributed_trace_async @@ -121,7 +127,8 @@ async def begin_reimage( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -133,6 +140,7 @@ async def begin_reimage( 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 ) @@ -156,10 +164,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore async def _reimage_all_initial( self, @@ -174,18 +181,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -201,7 +215,7 @@ async def _reimage_all_initial( return deserialized - _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 @distributed_trace_async @@ -235,7 +249,8 @@ async def begin_reimage_all( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -247,6 +262,7 @@ 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 ) @@ -270,10 +286,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) + 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 + begin_reimage_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall"} # type: ignore async def _deallocate_initial( self, @@ -288,18 +303,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -315,7 +337,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -350,7 +372,8 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -362,6 +385,7 @@ 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 ) @@ -385,10 +409,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -404,6 +427,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -413,6 +437,7 @@ async def _update_initial( 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'], @@ -420,7 +445,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -438,7 +467,7 @@ async def _update_initial( 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 @@ -475,8 +504,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -489,6 +519,7 @@ 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 @@ -513,10 +544,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore async def _delete_initial( self, @@ -531,18 +561,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -558,7 +595,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -591,7 +628,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -603,6 +641,7 @@ async def begin_delete( 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 ) @@ -626,10 +665,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -658,18 +696,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -683,7 +728,7 @@ async def get( 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 @@ -713,18 +758,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -738,7 +790,7 @@ async def get_instance_view( 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 @@ -759,12 +811,13 @@ 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 @@ -773,6 +826,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -785,6 +840,7 @@ def prepare_request(next_link=None): 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, @@ -799,6 +855,7 @@ def prepare_request(next_link=None): 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, @@ -819,7 +876,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]: @@ -832,7 +893,7 @@ async def get_next(next_link=None): 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( self, @@ -847,18 +908,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -874,7 +942,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -909,7 +977,8 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -921,6 +990,7 @@ async def begin_power_off( 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 ) @@ -944,10 +1014,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore async def _restart_initial( self, @@ -962,18 +1031,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -989,7 +1065,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -1022,7 +1098,8 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1034,6 +1111,7 @@ 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 ) @@ -1057,10 +1135,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore async def _start_initial( self, @@ -1075,18 +1152,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1102,7 +1186,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1135,7 +1219,8 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1147,6 +1232,7 @@ 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 ) @@ -1170,10 +1256,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore async def _redeploy_initial( self, @@ -1188,18 +1273,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1215,7 +1307,7 @@ async def _redeploy_initial( return deserialized - _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 @distributed_trace_async @@ -1249,7 +1341,8 @@ async def begin_redeploy( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1261,6 +1354,7 @@ 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 ) @@ -1284,10 +1378,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore async def _perform_maintenance_initial( self, @@ -1302,18 +1395,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1329,7 +1429,7 @@ async def _perform_maintenance_initial( return deserialized - _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 @distributed_trace_async @@ -1362,7 +1462,8 @@ async def begin_perform_maintenance( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1374,6 +1475,7 @@ 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 ) @@ -1397,7 +1499,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_sets_operations.py index 39a1c5e3bee4..38d05767a4db 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -190,6 +197,7 @@ async def _update_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'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -211,7 +223,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,10 +295,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _delete_initial( self, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -324,7 +344,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -354,7 +374,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -365,6 +386,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -388,10 +410,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -417,17 +438,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -441,7 +469,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _deallocate_initial( @@ -457,6 +485,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -468,6 +497,7 @@ async def _deallocate_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'], @@ -475,7 +505,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -491,7 +525,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -510,7 +544,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -527,8 +562,9 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -540,6 +576,7 @@ 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 @@ -564,10 +601,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore async def _delete_instances_initial( self, @@ -582,6 +618,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -590,6 +627,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -597,7 +635,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -613,7 +655,7 @@ async def _delete_instances_initial( return deserialized - _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 @distributed_trace_async @@ -647,8 +689,9 @@ async def begin_delete_instances( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -660,6 +703,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -684,10 +728,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) + 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 + 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( @@ -713,17 +756,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -737,7 +787,7 @@ async def get_instance_view( 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 @@ -757,6 +807,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -768,6 +820,7 @@ def prepare_request(next_link=None): 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) @@ -778,6 +831,7 @@ def prepare_request(next_link=None): 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) @@ -795,7 +849,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]: @@ -808,7 +866,7 @@ async def get_next(next_link=None): 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( @@ -826,6 +884,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -836,6 +896,7 @@ def prepare_request(next_link=None): 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) @@ -845,6 +906,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -862,7 +924,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]: @@ -875,7 +941,7 @@ async def get_next(next_link=None): 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( @@ -898,6 +964,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -910,6 +978,7 @@ def prepare_request(next_link=None): 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) @@ -921,6 +990,7 @@ def prepare_request(next_link=None): 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) @@ -938,7 +1008,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]: @@ -951,7 +1025,7 @@ async def get_next(next_link=None): 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( @@ -973,6 +1047,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -985,6 +1061,7 @@ def prepare_request(next_link=None): 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) @@ -996,6 +1073,7 @@ def prepare_request(next_link=None): 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) @@ -1013,7 +1091,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]: @@ -1026,7 +1108,7 @@ async def get_next(next_link=None): 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( self, @@ -1041,6 +1123,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1052,6 +1135,7 @@ async def _power_off_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._power_off_initial.metadata['url'], @@ -1059,7 +1143,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1075,7 +1163,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -1094,7 +1182,8 @@ async def begin_power_off( :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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1111,8 +1200,9 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1124,6 +1214,7 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1148,10 +1239,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore async def _restart_initial( self, @@ -1166,6 +1256,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1177,6 +1268,7 @@ async def _restart_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'], @@ -1184,7 +1276,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1200,7 +1296,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -1217,7 +1313,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1234,8 +1331,9 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1247,6 +1345,7 @@ 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 @@ -1271,10 +1370,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore async def _start_initial( self, @@ -1289,6 +1387,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1300,6 +1399,7 @@ async def _start_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'], @@ -1307,7 +1407,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1323,7 +1427,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1340,7 +1444,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1357,8 +1462,9 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1370,6 +1476,7 @@ 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 @@ -1394,10 +1501,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore async def _redeploy_initial( self, @@ -1412,6 +1518,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1423,6 +1530,7 @@ async def _redeploy_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'], @@ -1430,7 +1538,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1446,7 +1558,7 @@ async def _redeploy_initial( return deserialized - _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 @distributed_trace_async @@ -1464,7 +1576,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1481,8 +1594,9 @@ async def begin_redeploy( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1494,6 +1608,7 @@ 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 @@ -1518,10 +1633,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore async def _perform_maintenance_initial( self, @@ -1536,6 +1650,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1547,6 +1662,7 @@ async def _perform_maintenance_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'], @@ -1554,7 +1670,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1570,7 +1690,7 @@ async def _perform_maintenance_initial( return deserialized - _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 @distributed_trace_async @@ -1590,7 +1710,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1607,8 +1728,9 @@ async def begin_perform_maintenance( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1620,6 +1742,7 @@ 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 @@ -1644,10 +1767,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore async def _update_instances_initial( self, @@ -1662,6 +1784,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1670,6 +1793,7 @@ async def _update_instances_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'], @@ -1677,7 +1801,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1693,7 +1821,7 @@ async def _update_instances_initial( return deserialized - _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 @distributed_trace_async @@ -1727,8 +1855,9 @@ async def begin_update_instances( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1740,6 +1869,7 @@ 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 @@ -1764,10 +1894,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) + 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 + begin_update_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore async def _reimage_initial( self, @@ -1782,6 +1911,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1793,6 +1923,7 @@ async def _reimage_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'], @@ -1800,7 +1931,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1816,7 +1951,7 @@ async def _reimage_initial( return deserialized - _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 @distributed_trace_async @@ -1833,7 +1968,8 @@ 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_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1850,8 +1986,9 @@ async def begin_reimage( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1863,6 +2000,7 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1887,10 +2025,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore async def _reimage_all_initial( self, @@ -1905,6 +2042,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1916,6 +2054,7 @@ async def _reimage_all_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'], @@ -1923,7 +2062,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1939,7 +2082,7 @@ async def _reimage_all_initial( return deserialized - _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 @distributed_trace_async @@ -1957,7 +2100,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1974,8 +2118,9 @@ async def begin_reimage_all( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1987,6 +2132,7 @@ 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 @@ -2011,10 +2157,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) + 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 + 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( @@ -2045,18 +2190,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -2070,5 +2222,5 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_sizes_operations.py index c3ef230b74f2..4675faa4d70c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machines_operations.py index b134f4efc50a..cf9e3e605ac3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -62,7 +61,7 @@ async def get_extensions( :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) @@ -75,18 +74,25 @@ async def get_extensions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_get_extensions_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_extensions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -100,7 +106,7 @@ async def get_extensions( return deserialized - get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + get_extensions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore @distributed_trace @@ -120,6 +126,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -131,6 +139,7 @@ def prepare_request(next_link=None): 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) @@ -141,6 +150,7 @@ def prepare_request(next_link=None): 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) @@ -158,7 +168,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]: @@ -171,7 +185,7 @@ async def get_next(next_link=None): 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, @@ -186,6 +200,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -194,6 +209,7 @@ async def _capture_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'], @@ -201,7 +217,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -217,7 +237,7 @@ async def _capture_initial( 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 @@ -251,8 +271,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -264,6 +285,7 @@ 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 @@ -288,10 +310,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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -306,6 +327,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -314,6 +336,7 @@ async def _create_or_update_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'], @@ -321,7 +344,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -339,7 +366,7 @@ async def _create_or_update_initial( 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 @@ -372,8 +399,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,6 +413,7 @@ 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 @@ -409,10 +438,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -427,6 +455,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -435,6 +464,7 @@ async def _update_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'], @@ -442,7 +472,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -460,7 +494,7 @@ async def _update_initial( 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 @@ -493,8 +527,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -506,6 +541,7 @@ 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 @@ -530,10 +566,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _delete_initial( self, @@ -547,17 +582,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -573,7 +615,7 @@ async def _delete_initial( return deserialized - _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 @distributed_trace_async @@ -603,7 +645,8 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -614,6 +657,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -637,10 +681,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -656,8 +699,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -670,18 +713,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -695,7 +745,7 @@ async def get( 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 @@ -722,17 +772,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -746,7 +803,7 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore async def _convert_to_managed_disks_initial( @@ -761,17 +818,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -787,7 +851,7 @@ async def _convert_to_managed_disks_initial( return deserialized - _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 @distributed_trace_async @@ -818,7 +882,8 @@ async def begin_convert_to_managed_disks( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -829,6 +894,7 @@ 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 ) @@ -852,10 +918,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) + 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 + begin_convert_to_managed_disks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks"} # type: ignore async def _deallocate_initial( self, @@ -869,17 +934,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -895,7 +967,7 @@ async def _deallocate_initial( return deserialized - _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 @distributed_trace_async @@ -926,7 +998,8 @@ async def begin_deallocate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -937,6 +1010,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -960,10 +1034,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async async def generalize( @@ -989,17 +1062,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -1013,7 +1093,7 @@ async def generalize( return deserialized - 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 @@ -1034,6 +1114,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1045,6 +1127,7 @@ def prepare_request(next_link=None): 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) @@ -1055,6 +1138,7 @@ def prepare_request(next_link=None): 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) @@ -1072,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]: @@ -1085,7 +1173,7 @@ async def get_next(next_link=None): 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( @@ -1102,6 +1190,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1112,6 +1202,7 @@ def prepare_request(next_link=None): 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) @@ -1121,6 +1212,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1138,7 +1230,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]: @@ -1151,7 +1247,7 @@ async def get_next(next_link=None): 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( @@ -1174,6 +1270,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1186,6 +1284,7 @@ def prepare_request(next_link=None): 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) @@ -1197,6 +1296,7 @@ def prepare_request(next_link=None): 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) @@ -1214,7 +1314,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]: @@ -1227,7 +1331,7 @@ async def get_next(next_link=None): 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( self, @@ -1241,17 +1345,24 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1267,7 +1378,7 @@ async def _power_off_initial( return deserialized - _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 @distributed_trace_async @@ -1298,7 +1409,8 @@ async def begin_power_off( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1309,6 +1421,7 @@ async def begin_power_off( raw_result = await self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1332,10 +1445,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore async def _restart_initial( self, @@ -1349,17 +1461,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -1375,7 +1494,7 @@ async def _restart_initial( return deserialized - _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 @distributed_trace_async @@ -1405,7 +1524,8 @@ async def begin_restart( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1416,6 +1536,7 @@ 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 ) @@ -1439,10 +1560,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore async def _start_initial( self, @@ -1456,17 +1576,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -1482,7 +1609,7 @@ async def _start_initial( return deserialized - _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 @distributed_trace_async @@ -1512,7 +1639,8 @@ async def begin_start( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1523,6 +1651,7 @@ 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 ) @@ -1546,10 +1675,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore async def _redeploy_initial( self, @@ -1563,17 +1691,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -1589,7 +1724,7 @@ async def _redeploy_initial( return deserialized - _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 @distributed_trace_async @@ -1619,7 +1754,8 @@ async def begin_redeploy( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1630,6 +1766,7 @@ 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 ) @@ -1653,10 +1790,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore async def _perform_maintenance_initial( self, @@ -1670,17 +1806,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -1696,7 +1839,7 @@ async def _perform_maintenance_initial( return deserialized - _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 @distributed_trace_async @@ -1726,7 +1869,8 @@ async def begin_perform_maintenance( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1737,6 +1881,7 @@ 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 ) @@ -1760,16 +1905,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # 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"]] @@ -1778,7 +1924,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1786,6 +1932,7 @@ async def _run_command_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'], @@ -1793,7 +1940,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1809,7 +1960,7 @@ async def _run_command_initial( 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 @@ -1818,6 +1969,8 @@ async def begin_run_command( 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. @@ -1828,6 +1981,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2017_12_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 @@ -1842,8 +1998,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2017_12_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2017-12-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( 'polling_interval', @@ -1856,6 +2012,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1879,7 +2036,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_availability_sets_operations.py index 1bd03ffed60c..04c6396b4477 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,31 +121,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -156,31 +157,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -191,31 +193,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -225,30 +228,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -259,31 +263,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -336,6 +341,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -344,6 +350,7 @@ def create_or_update( 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'], @@ -351,7 +358,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -365,7 +376,7 @@ def create_or_update( 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 @@ -395,6 +406,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -403,6 +415,7 @@ def update( 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'], @@ -410,7 +423,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -424,7 +441,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace @@ -451,17 +468,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -477,7 +501,7 @@ def delete( return deserialized - 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 @@ -504,17 +528,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -528,7 +559,7 @@ def get( 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 @@ -540,7 +571,7 @@ 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 @@ -549,6 +580,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -559,6 +592,7 @@ def prepare_request(next_link=None): 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'], ) @@ -569,6 +603,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -587,7 +622,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]: @@ -600,7 +639,7 @@ def get_next(next_link=None): 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( @@ -619,6 +658,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -630,6 +671,7 @@ def prepare_request(next_link=None): 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) @@ -640,6 +682,7 @@ def prepare_request(next_link=None): 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) @@ -657,7 +700,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]: @@ -670,7 +717,7 @@ def get_next(next_link=None): 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( @@ -693,6 +740,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -705,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -716,6 +766,7 @@ def prepare_request(next_link=None): 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) @@ -733,7 +784,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]: @@ -746,4 +801,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_images_operations.py index 8eb8377feba4..9316bf3dbe9c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -160,33 +161,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,30 +198,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -228,29 +231,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -289,6 +293,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -297,6 +302,7 @@ def _create_or_update_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'], @@ -304,7 +310,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -322,7 +332,7 @@ def _create_or_update_initial( 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 @@ -353,8 +363,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -366,6 +377,7 @@ 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 @@ -390,10 +402,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -408,6 +419,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -416,6 +428,7 @@ def _update_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'], @@ -423,7 +436,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -441,7 +458,7 @@ def _update_initial( 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 @@ -472,8 +489,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -485,6 +503,7 @@ 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 @@ -509,10 +528,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _delete_initial( self, @@ -526,17 +544,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -552,7 +577,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -582,7 +607,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -593,6 +619,7 @@ 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 ) @@ -616,10 +643,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -635,7 +661,7 @@ 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) @@ -648,18 +674,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -673,7 +706,7 @@ def get( 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 @@ -691,6 +724,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -702,6 +737,7 @@ def prepare_request(next_link=None): 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) @@ -712,6 +748,7 @@ def prepare_request(next_link=None): 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) @@ -729,7 +766,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]: @@ -742,7 +783,7 @@ def get_next(next_link=None): 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( @@ -757,6 +798,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -767,6 +810,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -776,6 +820,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -793,7 +838,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]: @@ -806,4 +855,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_log_analytics_operations.py index cbf8451e1286..1d3ebb24540e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py index b308cf831c18..26fc8fd57a62 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_usage_operations.py index 509b0757f087..70617b7746ec 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extension_images_operations.py index 42841c78e9ab..da02339a6d12 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extensions_operations.py index fa73aaaa800d..e433ffdab9b6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,10 +127,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -138,21 +139,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,10 +167,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -177,23 +179,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -233,6 +235,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -242,6 +245,7 @@ def _create_or_update_initial( 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'], @@ -249,7 +253,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -267,7 +275,7 @@ def _create_or_update_initial( 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 @@ -305,8 +313,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -319,6 +328,7 @@ 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 @@ -343,10 +353,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -362,6 +371,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -371,6 +381,7 @@ def _update_initial( 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'], @@ -378,7 +389,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -392,7 +407,7 @@ def _update_initial( 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 @@ -430,8 +445,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -444,6 +460,7 @@ 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 @@ -468,10 +485,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _delete_initial( self, @@ -486,18 +502,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -513,7 +536,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -546,7 +569,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -558,6 +582,7 @@ 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 ) @@ -581,10 +606,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -603,7 +627,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) @@ -616,19 +640,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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) - 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]: @@ -642,5 +673,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_images_operations.py index d6d2e0226d09..777c531c4223 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_run_commands_operations.py index 4776f5d45875..e9b34a4111e0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -65,31 +66,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -132,6 +134,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -143,6 +147,7 @@ def prepare_request(next_link=None): 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) @@ -153,6 +158,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -170,7 +176,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]: @@ -183,7 +193,7 @@ def get_next(next_link=None): 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( @@ -209,17 +219,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -233,5 +250,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_extensions_operations.py index c0a1ec42675a..18ae6fe12078 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,10 +82,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -93,21 +94,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,10 +122,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -132,23 +134,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -159,31 +161,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -223,6 +226,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -232,6 +236,7 @@ def _create_or_update_initial( 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'], @@ -239,7 +244,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -257,7 +266,7 @@ def _create_or_update_initial( 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 @@ -296,8 +305,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,6 +320,7 @@ 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 @@ -334,10 +345,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore def _delete_initial( self, @@ -352,18 +362,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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,7 +396,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -412,7 +429,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -424,6 +442,7 @@ 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 ) @@ -447,10 +466,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -469,7 +487,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) @@ -482,19 +500,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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) - 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,7 +533,7 @@ def get( 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 @@ -531,6 +556,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -543,6 +570,7 @@ def prepare_request(next_link=None): 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) @@ -554,6 +582,7 @@ def prepare_request(next_link=None): 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) @@ -571,7 +600,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]: @@ -584,4 +617,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 5f62f6d7dbdb..56b8aa50ec20 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,31 +33,32 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,31 +69,32 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -103,31 +105,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,17 +168,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -191,7 +201,7 @@ def _cancel_initial( return deserialized - _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 @distributed_trace @@ -221,7 +231,8 @@ def begin_cancel( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -232,6 +243,7 @@ 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 ) @@ -255,10 +267,9 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore def _start_os_upgrade_initial( self, @@ -272,17 +283,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,7 +316,7 @@ def _start_os_upgrade_initial( return deserialized - _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 @distributed_trace @@ -330,7 +348,8 @@ def begin_start_os_upgrade( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -341,6 +360,7 @@ 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 ) @@ -364,10 +384,9 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -393,17 +412,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -417,5 +443,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_vms_operations.py index 6440003cf45c..307dc829d51d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,10 +36,11 @@ def build_reimage_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -47,21 +48,21 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -73,10 +74,11 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -84,21 +86,21 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -121,21 +124,21 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,12 +153,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -163,23 +166,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -193,10 +196,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -204,21 +208,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -230,10 +234,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -241,21 +246,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -267,10 +272,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-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') + _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'), @@ -278,21 +284,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -307,37 +313,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -349,10 +356,11 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -360,21 +368,21 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -386,10 +394,11 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -397,21 +406,21 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -423,10 +432,11 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -434,21 +444,21 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -460,10 +470,11 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -471,21 +482,21 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -497,10 +508,11 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -508,25 +520,25 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -561,18 +573,25 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -588,7 +607,7 @@ def _reimage_initial( return deserialized - _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 @distributed_trace @@ -621,7 +640,8 @@ def begin_reimage( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -633,6 +653,7 @@ def begin_reimage( 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 ) @@ -656,10 +677,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage"} # type: ignore def _reimage_all_initial( self, @@ -674,18 +694,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -701,7 +728,7 @@ def _reimage_all_initial( return deserialized - _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 @distributed_trace @@ -735,7 +762,8 @@ def begin_reimage_all( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -747,6 +775,7 @@ 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 ) @@ -770,10 +799,9 @@ 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) + 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 + begin_reimage_all.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall"} # type: ignore def _deallocate_initial( self, @@ -788,18 +816,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -815,7 +850,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -850,7 +885,8 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -862,6 +898,7 @@ 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 ) @@ -885,10 +922,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -904,6 +940,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -913,6 +950,7 @@ def _update_initial( 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'], @@ -920,7 +958,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -938,7 +980,7 @@ def _update_initial( 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 @@ -975,8 +1017,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -989,6 +1032,7 @@ 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 @@ -1013,10 +1057,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore def _delete_initial( self, @@ -1031,18 +1074,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1058,7 +1108,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -1091,7 +1141,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1103,6 +1154,7 @@ def begin_delete( 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 ) @@ -1126,10 +1178,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1158,18 +1209,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1183,7 +1241,7 @@ def get( 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 @@ -1213,18 +1271,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -1238,7 +1303,7 @@ def get_instance_view( 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 @@ -1259,12 +1324,13 @@ 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 @@ -1273,6 +1339,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1285,6 +1353,7 @@ def prepare_request(next_link=None): 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, @@ -1299,6 +1368,7 @@ def prepare_request(next_link=None): 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, @@ -1319,7 +1389,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]: @@ -1332,7 +1406,7 @@ def get_next(next_link=None): 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( self, @@ -1347,18 +1421,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1374,7 +1455,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1409,7 +1490,8 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1421,6 +1503,7 @@ def begin_power_off( 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 ) @@ -1444,10 +1527,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore def _restart_initial( self, @@ -1462,18 +1544,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1489,7 +1578,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -1522,7 +1611,8 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1534,6 +1624,7 @@ 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 ) @@ -1557,10 +1648,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore def _start_initial( self, @@ -1575,18 +1665,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1602,7 +1699,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -1635,7 +1732,8 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1647,6 +1745,7 @@ 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 ) @@ -1670,10 +1769,9 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore def _redeploy_initial( self, @@ -1688,18 +1786,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1715,7 +1820,7 @@ def _redeploy_initial( return deserialized - _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 @distributed_trace @@ -1749,7 +1854,8 @@ def begin_redeploy( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1761,6 +1867,7 @@ 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 ) @@ -1784,10 +1891,9 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore def _perform_maintenance_initial( self, @@ -1802,18 +1908,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1829,7 +1942,7 @@ def _perform_maintenance_initial( return deserialized - _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 @distributed_trace @@ -1862,7 +1975,8 @@ def begin_perform_maintenance( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1874,6 +1988,7 @@ 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 ) @@ -1897,7 +2012,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_sets_operations.py index 461313db0a74..482c1e39a262 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,35 +198,35 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -240,35 +242,35 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -281,31 +283,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -315,30 +318,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -347,29 +351,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -380,31 +385,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -415,31 +421,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -453,35 +460,35 @@ def build_power_off_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -497,35 +504,35 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -541,35 +548,35 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -585,35 +592,35 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -629,35 +636,35 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -673,35 +680,35 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -717,35 +724,35 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -761,35 +768,35 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -804,36 +811,37 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -868,6 +876,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -876,6 +885,7 @@ def _create_or_update_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'], @@ -883,7 +893,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -901,7 +915,7 @@ def _create_or_update_initial( 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 @@ -934,8 +948,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -947,6 +962,7 @@ 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 @@ -971,10 +987,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -989,6 +1004,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -997,6 +1013,7 @@ def _update_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'], @@ -1004,7 +1021,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1018,7 +1039,7 @@ def _update_initial( 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 @@ -1051,8 +1072,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1064,6 +1086,7 @@ 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 @@ -1088,10 +1111,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _delete_initial( self, @@ -1105,17 +1127,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1131,7 +1160,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -1161,7 +1190,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1172,6 +1202,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -1195,10 +1226,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1224,17 +1254,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1248,7 +1285,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _deallocate_initial( @@ -1264,6 +1301,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1275,6 +1313,7 @@ def _deallocate_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'], @@ -1282,7 +1321,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1298,7 +1341,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -1317,7 +1360,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1334,8 +1378,9 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1347,6 +1392,7 @@ 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 @@ -1371,10 +1417,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore def _delete_instances_initial( self, @@ -1389,6 +1434,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1397,6 +1443,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1404,7 +1451,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1420,7 +1471,7 @@ def _delete_instances_initial( return deserialized - _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 @distributed_trace @@ -1454,8 +1505,9 @@ def begin_delete_instances( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1467,6 +1519,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1491,10 +1544,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1520,17 +1572,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -1544,7 +1603,7 @@ def get_instance_view( 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 @@ -1564,6 +1623,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1575,6 +1636,7 @@ def prepare_request(next_link=None): 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) @@ -1585,6 +1647,7 @@ def prepare_request(next_link=None): 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) @@ -1602,7 +1665,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]: @@ -1615,7 +1682,7 @@ def get_next(next_link=None): 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( @@ -1633,6 +1700,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1643,6 +1712,7 @@ def prepare_request(next_link=None): 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) @@ -1652,6 +1722,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1669,7 +1740,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]: @@ -1682,7 +1757,7 @@ def get_next(next_link=None): 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( @@ -1705,6 +1780,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1717,6 +1794,7 @@ def prepare_request(next_link=None): 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) @@ -1728,6 +1806,7 @@ def prepare_request(next_link=None): 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) @@ -1745,7 +1824,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]: @@ -1758,7 +1841,7 @@ def get_next(next_link=None): 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( @@ -1780,6 +1863,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1792,6 +1877,7 @@ def prepare_request(next_link=None): 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) @@ -1803,6 +1889,7 @@ def prepare_request(next_link=None): 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) @@ -1820,7 +1907,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]: @@ -1833,7 +1924,7 @@ def get_next(next_link=None): 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( self, @@ -1848,6 +1939,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1859,6 +1951,7 @@ def _power_off_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._power_off_initial.metadata['url'], @@ -1866,7 +1959,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1882,7 +1979,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -1901,7 +1998,8 @@ def begin_power_off( :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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1918,8 +2016,9 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1931,6 +2030,7 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1955,10 +2055,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore def _restart_initial( self, @@ -1973,6 +2072,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1984,6 +2084,7 @@ def _restart_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'], @@ -1991,7 +2092,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2007,7 +2112,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -2024,7 +2129,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2041,8 +2147,9 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2054,6 +2161,7 @@ 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 @@ -2078,10 +2186,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore def _start_initial( self, @@ -2096,6 +2203,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2107,6 +2215,7 @@ def _start_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'], @@ -2114,7 +2223,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2130,7 +2243,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -2147,7 +2260,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2164,8 +2278,9 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2177,6 +2292,7 @@ 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 @@ -2201,10 +2317,9 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore def _redeploy_initial( self, @@ -2219,6 +2334,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2230,6 +2346,7 @@ def _redeploy_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'], @@ -2237,7 +2354,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2253,7 +2374,7 @@ def _redeploy_initial( return deserialized - _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 @distributed_trace @@ -2271,7 +2392,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2288,8 +2410,9 @@ def begin_redeploy( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2301,6 +2424,7 @@ 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 @@ -2325,10 +2449,9 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore def _perform_maintenance_initial( self, @@ -2343,6 +2466,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2354,6 +2478,7 @@ def _perform_maintenance_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'], @@ -2361,7 +2486,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2377,7 +2506,7 @@ def _perform_maintenance_initial( return deserialized - _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 @distributed_trace @@ -2397,7 +2526,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2414,8 +2544,9 @@ def begin_perform_maintenance( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2427,6 +2558,7 @@ 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 @@ -2451,10 +2583,9 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore def _update_instances_initial( self, @@ -2469,6 +2600,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2477,6 +2609,7 @@ def _update_instances_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'], @@ -2484,7 +2617,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2500,7 +2637,7 @@ def _update_instances_initial( return deserialized - _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 @distributed_trace @@ -2534,8 +2671,9 @@ def begin_update_instances( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2547,6 +2685,7 @@ 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 @@ -2571,10 +2710,9 @@ 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) + 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 + begin_update_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore def _reimage_initial( self, @@ -2589,6 +2727,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2600,6 +2739,7 @@ def _reimage_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'], @@ -2607,7 +2747,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2623,7 +2767,7 @@ def _reimage_initial( return deserialized - _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 @distributed_trace @@ -2640,7 +2784,8 @@ 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_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2657,8 +2802,9 @@ def begin_reimage( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2670,6 +2816,7 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -2694,10 +2841,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore def _reimage_all_initial( self, @@ -2712,6 +2858,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2723,6 +2870,7 @@ def _reimage_all_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'], @@ -2730,7 +2878,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2746,7 +2898,7 @@ def _reimage_all_initial( return deserialized - _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 @distributed_trace @@ -2764,7 +2916,8 @@ 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. + :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.v2017_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2781,8 +2934,9 @@ def begin_reimage_all( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2794,6 +2948,7 @@ 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 @@ -2818,10 +2973,9 @@ 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) + 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 + 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( @@ -2852,18 +3006,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -2877,5 +3038,5 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_sizes_operations.py index 2033c987be69..edc7643c4adc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,6 +98,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -108,6 +111,7 @@ def prepare_request(next_link=None): 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) @@ -118,6 +122,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -135,7 +140,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]: @@ -148,4 +157,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machines_operations.py index 623d67f151ac..0cd6b4f83b77 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2017_12_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,33 +37,34 @@ def build_get_extensions_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -73,30 +74,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,35 +112,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -154,35 +156,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -198,35 +200,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -239,31 +241,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -276,33 +279,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -313,31 +317,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -348,31 +353,32 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -383,31 +389,32 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -418,31 +425,32 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -452,30 +460,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -484,29 +493,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -517,31 +527,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -552,31 +563,32 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -587,31 +599,32 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -622,31 +635,32 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -657,31 +671,32 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -692,31 +707,32 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2017-12-01" + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -730,41 +746,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2017-12-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -800,7 +816,7 @@ def get_extensions( :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) @@ -813,18 +829,25 @@ def get_extensions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_get_extensions_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_extensions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -838,7 +861,7 @@ def get_extensions( return deserialized - get_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore + get_extensions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore @distributed_trace @@ -858,6 +881,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -869,6 +894,7 @@ def prepare_request(next_link=None): 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) @@ -879,6 +905,7 @@ def prepare_request(next_link=None): 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) @@ -896,7 +923,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]: @@ -909,7 +940,7 @@ def get_next(next_link=None): 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, @@ -924,6 +955,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -932,6 +964,7 @@ def _capture_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'], @@ -939,7 +972,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -955,7 +992,7 @@ def _capture_initial( 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 @@ -989,8 +1026,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1002,6 +1040,7 @@ 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 @@ -1026,10 +1065,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -1044,6 +1082,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -1052,6 +1091,7 @@ def _create_or_update_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'], @@ -1059,7 +1099,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1077,7 +1121,7 @@ def _create_or_update_initial( 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 @@ -1109,8 +1153,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1122,6 +1167,7 @@ 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 @@ -1146,10 +1192,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1164,6 +1209,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1172,6 +1218,7 @@ def _update_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'], @@ -1179,7 +1226,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1197,7 +1248,7 @@ def _update_initial( 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 @@ -1229,8 +1280,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1242,6 +1294,7 @@ 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 @@ -1266,10 +1319,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _delete_initial( self, @@ -1283,17 +1335,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1309,7 +1368,7 @@ def _delete_initial( return deserialized - _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 @distributed_trace @@ -1339,7 +1398,8 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1350,6 +1410,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1373,10 +1434,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1392,8 +1452,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1406,18 +1466,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -1431,7 +1498,7 @@ def get( 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 @@ -1458,17 +1525,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: 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) - 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]: @@ -1482,7 +1556,7 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore def _convert_to_managed_disks_initial( @@ -1497,17 +1571,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1523,7 +1604,7 @@ def _convert_to_managed_disks_initial( return deserialized - _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 @distributed_trace @@ -1554,7 +1635,8 @@ def begin_convert_to_managed_disks( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1565,6 +1647,7 @@ 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 ) @@ -1588,10 +1671,9 @@ 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) + 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 + begin_convert_to_managed_disks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks"} # type: ignore def _deallocate_initial( self, @@ -1605,17 +1687,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1631,7 +1720,7 @@ def _deallocate_initial( return deserialized - _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 @distributed_trace @@ -1662,7 +1751,8 @@ def begin_deallocate( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -1673,6 +1763,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1696,10 +1787,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace def generalize( @@ -1725,17 +1815,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -1749,7 +1846,7 @@ def generalize( return deserialized - 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 @@ -1770,6 +1867,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1781,6 +1880,7 @@ def prepare_request(next_link=None): 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) @@ -1791,6 +1891,7 @@ def prepare_request(next_link=None): 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) @@ -1808,7 +1909,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]: @@ -1821,7 +1926,7 @@ def get_next(next_link=None): 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( @@ -1838,6 +1943,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1848,6 +1955,7 @@ def prepare_request(next_link=None): 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) @@ -1857,6 +1965,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1874,7 +1983,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]: @@ -1887,7 +2000,7 @@ def get_next(next_link=None): 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( @@ -1910,6 +2023,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2017_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1922,6 +2037,7 @@ def prepare_request(next_link=None): 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) @@ -1933,6 +2049,7 @@ def prepare_request(next_link=None): 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) @@ -1950,7 +2067,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]: @@ -1963,7 +2084,7 @@ def get_next(next_link=None): 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( self, @@ -1977,17 +2098,24 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -2003,7 +2131,7 @@ def _power_off_initial( return deserialized - _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 @distributed_trace @@ -2034,7 +2162,8 @@ def begin_power_off( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2045,6 +2174,7 @@ def begin_power_off( raw_result = self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2068,10 +2198,9 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore def _restart_initial( self, @@ -2085,17 +2214,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -2111,7 +2247,7 @@ def _restart_initial( return deserialized - _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 @distributed_trace @@ -2141,7 +2277,8 @@ def begin_restart( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2152,6 +2289,7 @@ 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 ) @@ -2175,10 +2313,9 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore def _start_initial( self, @@ -2192,17 +2329,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -2218,7 +2362,7 @@ def _start_initial( return deserialized - _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 @distributed_trace @@ -2248,7 +2392,8 @@ def begin_start( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2259,6 +2404,7 @@ 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 ) @@ -2282,10 +2428,9 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore def _redeploy_initial( self, @@ -2299,17 +2444,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -2325,7 +2477,7 @@ def _redeploy_initial( return deserialized - _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 @distributed_trace @@ -2355,7 +2507,8 @@ def begin_redeploy( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2366,6 +2519,7 @@ 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 ) @@ -2389,10 +2543,9 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore def _perform_maintenance_initial( self, @@ -2406,17 +2559,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + 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) - 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]: @@ -2432,7 +2592,7 @@ def _perform_maintenance_initial( return deserialized - _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 @distributed_trace @@ -2462,7 +2622,8 @@ def begin_perform_maintenance( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.OperationStatusResponse] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -2473,6 +2634,7 @@ 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 ) @@ -2496,16 +2658,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore def _run_command_initial( self, resource_group_name: 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"]] @@ -2514,7 +2677,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2017-12-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2522,6 +2685,7 @@ def _run_command_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'], @@ -2529,7 +2693,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2545,7 +2713,7 @@ def _run_command_initial( 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 @@ -2554,6 +2722,8 @@ def begin_run_command( 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. @@ -2564,6 +2734,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2017_12_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 @@ -2577,8 +2750,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2017_12_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2017-12-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( 'polling_interval', @@ -2591,6 +2764,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2614,7 +2788,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_compute_management_client.py index 99c61789eefd..75554c962ff3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -78,8 +79,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-04-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. """ @@ -120,7 +124,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_configuration.py index 2c18eba2dc6f..785661015835 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2018-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-04-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_metadata.json index 3ee57d4b9cc3..37206d1851de 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_compute_management_client.py index f4356bd4226f..826eea6fdd7f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -79,8 +80,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-04-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_configuration.py index ef0f24180ee5..aae91c25f66a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/_configuration.py @@ -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 "2018-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-04-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_availability_sets_operations.py index 047f1c11f6a9..95822b74e694 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_disks_operations.py index c500c0399bf9..04e77f239fc5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_images_operations.py index 35309c48cf56..d53f0fc20c86 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_log_analytics_operations.py index de522ef9d2fd..99a0c620efee 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_operations.py index 9c4cf4f25c7f..1dab8a2ddf2f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_proximity_placement_groups_operations.py index 9f3d91b7f65f..9b5e223eee65 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -239,17 +257,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -263,7 +288,7 @@ async def get( 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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) @@ -299,6 +327,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -316,7 +345,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]: @@ -329,7 +362,7 @@ async def get_next(next_link=None): 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( @@ -348,6 +381,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -359,6 +394,7 @@ def prepare_request(next_link=None): 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) @@ -369,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -386,7 +423,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]: @@ -399,4 +440,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_snapshots_operations.py index 52344076a913..de8619df0146 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_usage_operations.py index beab75a73a1d..47b286a4e517 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extension_images_operations.py index 318cf791bc62..ae3306184178 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extensions_operations.py index 81e78db6f802..805f4aa1109d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_images_operations.py index 6351f6f7c658..30ed32e2dcad 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_run_commands_operations.py index f05a1ff4a6b4..6e4af6170d09 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,7 +121,7 @@ async def get_next(next_link=None): 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( @@ -140,17 +147,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -164,5 +178,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 21e96d4bb6df..6a5489fd4c34 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,12 +180,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -191,18 +197,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -212,11 +225,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -243,7 +256,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -255,6 +269,7 @@ 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 ) @@ -275,10 +290,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -297,7 +311,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) @@ -310,19 +324,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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) - 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]: @@ -336,7 +357,7 @@ async def get( 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 @@ -359,6 +380,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -371,6 +394,7 @@ def prepare_request(next_link=None): 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) @@ -382,6 +406,7 @@ def prepare_request(next_link=None): 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) @@ -399,7 +424,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]: @@ -412,4 +441,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 4081128daf88..fb4d51319ab6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,10 +251,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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore @distributed_trace_async async def get_latest( @@ -264,17 +279,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -288,5 +310,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index e801f1d60a40..6e19700fc409 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -61,18 +60,25 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,11 +88,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -113,7 +119,8 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -125,6 +132,7 @@ async def begin_reimage( 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 ) @@ -145,12 +153,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) + 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 + 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, @@ -163,18 +170,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -184,11 +198,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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -216,7 +230,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -228,6 +243,7 @@ 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 ) @@ -248,12 +264,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) + 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 + 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, @@ -266,18 +281,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -287,11 +309,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -320,7 +342,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +355,7 @@ 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 ) @@ -352,10 +376,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -371,6 +394,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -380,6 +404,7 @@ async def _update_initial( 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'], @@ -387,7 +412,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -405,7 +434,7 @@ async def _update_initial( 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 @@ -442,8 +471,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -456,6 +486,7 @@ 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 @@ -480,12 +511,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) + 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 + 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, @@ -498,18 +528,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -519,11 +556,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -550,7 +587,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -562,6 +600,7 @@ async def begin_delete( 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 ) @@ -582,10 +621,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -614,18 +652,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -639,7 +684,7 @@ async def get( 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 @@ -669,18 +714,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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 +746,7 @@ async def get_instance_view( 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 @@ -715,12 +767,13 @@ 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 @@ -729,6 +782,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -741,6 +796,7 @@ def prepare_request(next_link=None): 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, @@ -755,6 +811,7 @@ def prepare_request(next_link=None): 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, @@ -775,7 +832,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]: @@ -788,9 +849,9 @@ async def get_next(next_link=None): 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, @@ -803,18 +864,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -824,11 +892,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -857,7 +925,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -869,6 +938,7 @@ async def begin_power_off( 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 ) @@ -889,12 +959,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -907,18 +976,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -928,11 +1004,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -959,7 +1035,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -971,6 +1048,7 @@ 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 ) @@ -991,12 +1069,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1009,18 +1086,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1030,11 +1114,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1061,7 +1145,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1073,6 +1158,7 @@ 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 ) @@ -1093,12 +1179,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1111,18 +1196,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1132,11 +1224,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1164,7 +1256,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1176,6 +1269,7 @@ 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 ) @@ -1196,12 +1290,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1214,18 +1307,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1235,11 +1335,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1266,7 +1366,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1278,6 +1379,7 @@ 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 ) @@ -1298,10 +1400,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore async def _run_command_initial( self, @@ -1309,6 +1410,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"]] @@ -1317,7 +1420,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1326,6 +1429,7 @@ async def _run_command_initial( 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'], @@ -1333,7 +1437,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1349,7 +1457,7 @@ async def _run_command_initial( 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 @@ -1359,6 +1467,8 @@ async def begin_run_command( 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. @@ -1371,6 +1481,9 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_04_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 @@ -1385,8 +1498,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-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( 'polling_interval', @@ -1400,6 +1513,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1423,7 +1537,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_sets_operations.py index cedeade6b33d..9ba17fdb1b96 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -190,6 +197,7 @@ async def _update_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'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -211,7 +223,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -318,11 +338,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -406,17 +427,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,10 +458,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -446,6 +474,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -457,6 +486,7 @@ async def _deallocate_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'], @@ -464,7 +494,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -474,11 +508,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -493,7 +527,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -508,8 +543,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,6 +557,7 @@ 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 @@ -542,12 +579,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) + 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 + 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, @@ -560,6 +596,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -568,6 +605,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -575,7 +613,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -585,11 +627,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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -617,8 +659,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -630,6 +673,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -651,10 +695,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) + 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 + 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( @@ -680,17 +723,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -704,7 +754,7 @@ async def get_instance_view( 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 @@ -724,6 +774,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -735,6 +787,7 @@ def prepare_request(next_link=None): 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) @@ -745,6 +798,7 @@ def prepare_request(next_link=None): 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) @@ -762,7 +816,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]: @@ -775,7 +833,7 @@ async def get_next(next_link=None): 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( @@ -793,6 +851,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -803,6 +863,7 @@ def prepare_request(next_link=None): 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) @@ -812,6 +873,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -829,7 +891,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]: @@ -842,7 +908,7 @@ async def get_next(next_link=None): 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( @@ -865,6 +931,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -877,6 +945,7 @@ def prepare_request(next_link=None): 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) @@ -888,6 +957,7 @@ def prepare_request(next_link=None): 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) @@ -905,7 +975,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]: @@ -918,7 +992,7 @@ async def get_next(next_link=None): 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( @@ -940,6 +1014,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -952,6 +1028,7 @@ def prepare_request(next_link=None): 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) @@ -963,6 +1040,7 @@ def prepare_request(next_link=None): 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) @@ -980,7 +1058,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]: @@ -993,9 +1075,9 @@ async def get_next(next_link=None): 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, @@ -1008,6 +1090,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1019,6 +1102,7 @@ async def _power_off_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._power_off_initial.metadata['url'], @@ -1026,7 +1110,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1036,11 +1124,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1055,7 +1143,8 @@ async def begin_power_off( :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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1070,8 +1159,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1083,6 +1173,7 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1104,12 +1195,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) + 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 + 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, @@ -1122,6 +1212,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1133,6 +1224,7 @@ async def _restart_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'], @@ -1140,7 +1232,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1150,11 +1246,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1167,7 +1263,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1182,8 +1279,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1195,6 +1293,7 @@ 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 @@ -1216,12 +1315,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) + 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 + 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, @@ -1234,6 +1332,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1245,6 +1344,7 @@ async def _start_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'], @@ -1252,7 +1352,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1262,11 +1366,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1279,7 +1383,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1294,8 +1399,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,6 +1413,7 @@ 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 @@ -1328,12 +1435,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) + 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 + 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, @@ -1346,6 +1452,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1357,6 +1464,7 @@ async def _redeploy_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'], @@ -1364,7 +1472,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1374,11 +1486,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1392,7 +1504,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1407,8 +1520,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1420,6 +1534,7 @@ 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 @@ -1441,12 +1556,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1459,6 +1573,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1470,6 +1585,7 @@ async def _perform_maintenance_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'], @@ -1477,7 +1593,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1487,11 +1607,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1507,7 +1627,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1522,8 +1643,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1535,6 +1657,7 @@ 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 @@ -1556,12 +1679,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1574,6 +1696,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1582,6 +1705,7 @@ async def _update_instances_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'], @@ -1589,7 +1713,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1599,11 +1727,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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1631,8 +1759,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1644,6 +1773,7 @@ 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 @@ -1665,12 +1795,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) + 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 + 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, @@ -1683,6 +1812,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1694,6 +1824,7 @@ async def _reimage_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'], @@ -1701,7 +1832,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1711,11 +1846,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1728,7 +1863,8 @@ 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_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1743,8 +1879,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1756,6 +1893,7 @@ async def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1777,12 +1915,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1795,6 +1932,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1806,6 +1944,7 @@ async def _reimage_all_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'], @@ -1813,7 +1952,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1823,11 +1966,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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1841,7 +1984,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1856,8 +2000,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1869,6 +2014,7 @@ 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 @@ -1890,10 +2036,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) + 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 + 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( @@ -1924,18 +2069,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -1949,5 +2101,5 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_sizes_operations.py index c8a9c5ba6677..f9ebe46e94b9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machines_operations.py index 63e61c5ed8d9..36d56406f8e9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -317,8 +337,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -330,6 +351,7 @@ 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 @@ -354,10 +376,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -372,6 +393,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -380,6 +402,7 @@ async def _update_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'], @@ -387,7 +410,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -405,7 +432,7 @@ async def _update_initial( 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 @@ -438,8 +465,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -451,6 +479,7 @@ 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 @@ -475,12 +504,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) + 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 + 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, @@ -492,17 +520,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -512,11 +547,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -540,7 +575,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -551,6 +587,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -571,10 +608,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -590,8 +626,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -604,18 +640,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -629,7 +672,7 @@ async def get( 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 @@ -656,17 +699,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -680,10 +730,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -695,17 +745,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -715,11 +772,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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -744,7 +801,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -755,6 +813,7 @@ 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 ) @@ -775,12 +834,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) + 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 + 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, @@ -792,17 +850,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -812,11 +877,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -841,7 +906,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -852,6 +918,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -872,13 +939,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -901,17 +967,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -921,7 +994,7 @@ 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 @@ -942,6 +1015,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -953,6 +1028,7 @@ def prepare_request(next_link=None): 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) @@ -963,6 +1039,7 @@ def prepare_request(next_link=None): 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) @@ -980,7 +1057,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]: @@ -993,7 +1074,7 @@ async def get_next(next_link=None): 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( @@ -1010,6 +1091,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1020,6 +1103,7 @@ def prepare_request(next_link=None): 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) @@ -1029,6 +1113,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1046,7 +1131,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]: @@ -1059,7 +1148,7 @@ async def get_next(next_link=None): 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( @@ -1082,6 +1171,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1094,6 +1185,7 @@ def prepare_request(next_link=None): 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) @@ -1105,6 +1197,7 @@ def prepare_request(next_link=None): 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) @@ -1122,7 +1215,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]: @@ -1135,9 +1232,9 @@ async def get_next(next_link=None): 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, @@ -1149,17 +1246,24 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1169,11 +1273,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1198,7 +1302,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1209,6 +1314,7 @@ async def begin_power_off( raw_result = await self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1229,12 +1335,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1246,17 +1351,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -1266,11 +1378,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1294,7 +1406,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1305,6 +1418,7 @@ 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 ) @@ -1325,12 +1439,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) + 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 + 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, @@ -1342,17 +1455,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -1362,11 +1482,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1390,7 +1510,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1401,6 +1522,7 @@ 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 ) @@ -1421,12 +1543,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) + 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 + 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, @@ -1438,17 +1559,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -1458,11 +1586,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1486,7 +1614,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1497,6 +1626,7 @@ 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 ) @@ -1517,12 +1647,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1534,17 +1663,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -1554,11 +1690,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1582,7 +1718,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1593,6 +1730,7 @@ 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 ) @@ -1613,16 +1751,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # 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"]] @@ -1631,7 +1770,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1639,6 +1778,7 @@ async def _run_command_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'], @@ -1646,7 +1786,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1662,7 +1806,7 @@ async def _run_command_initial( 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 @@ -1671,6 +1815,8 @@ async def begin_run_command( 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. @@ -1681,6 +1827,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_04_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 @@ -1695,8 +1844,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_04_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-04-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( 'polling_interval', @@ -1709,6 +1858,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1732,7 +1882,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_availability_sets_operations.py index 66968231f8e4..c3350137b436 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -185,31 +187,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -253,31 +257,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,6 +335,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -338,6 +344,7 @@ def create_or_update( 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'], @@ -345,7 +352,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -359,7 +370,7 @@ def create_or_update( 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 @@ -389,6 +400,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -397,6 +409,7 @@ def update( 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'], @@ -404,7 +417,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +435,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -445,17 +462,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -465,7 +489,7 @@ 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 @@ -492,17 +516,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -516,7 +547,7 @@ def get( 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 @@ -528,7 +559,7 @@ 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 @@ -537,6 +568,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -547,6 +580,7 @@ def prepare_request(next_link=None): 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'], ) @@ -557,6 +591,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -575,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]: @@ -588,7 +627,7 @@ def get_next(next_link=None): 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( @@ -607,6 +646,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -618,6 +659,7 @@ def prepare_request(next_link=None): 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) @@ -628,6 +670,7 @@ def prepare_request(next_link=None): 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) @@ -645,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]: @@ -658,7 +705,7 @@ def get_next(next_link=None): 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( @@ -681,6 +728,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_disks_operations.py index b5e3950921a4..4d1e5531c93f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_images_operations.py index 0da8f2ac470c..55fd4ef3e06b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -154,33 +155,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -291,6 +296,7 @@ def _create_or_update_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'], @@ -298,7 +304,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -316,7 +326,7 @@ def _create_or_update_initial( 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 @@ -347,8 +357,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -360,6 +371,7 @@ 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 @@ -384,10 +396,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -402,6 +413,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -410,6 +422,7 @@ def _update_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'], @@ -417,7 +430,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -435,7 +452,7 @@ def _update_initial( 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 @@ -466,8 +483,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +497,7 @@ 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 @@ -503,12 +522,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -520,17 +538,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -540,11 +565,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -568,7 +593,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,6 +605,7 @@ 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 ) @@ -599,10 +626,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -618,7 +644,7 @@ 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) @@ -631,18 +657,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -656,7 +689,7 @@ def get( 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 @@ -674,6 +707,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -685,6 +720,7 @@ def prepare_request(next_link=None): 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) @@ -695,6 +731,7 @@ def prepare_request(next_link=None): 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) @@ -712,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]: @@ -725,7 +766,7 @@ def get_next(next_link=None): 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( @@ -740,6 +781,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -750,6 +793,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -759,6 +803,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -776,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]: @@ -789,4 +838,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_log_analytics_operations.py index 517cd1e6ce79..75cf8c371576 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_operations.py index 1cc59ca62a67..a7fb20a6acb1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_proximity_placement_groups_operations.py index 9ea263bbc1b3..3e5936239f63 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,29 +185,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,30 +218,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -291,6 +295,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -299,6 +304,7 @@ def create_or_update( 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'], @@ -306,7 +312,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -324,7 +334,7 @@ def create_or_update( 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 @@ -354,6 +364,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -362,6 +373,7 @@ def update( 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'], @@ -369,7 +381,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -383,11 +399,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -410,17 +426,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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,7 +453,7 @@ 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 @@ -457,17 +480,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -481,7 +511,7 @@ def get( 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 @@ -498,6 +528,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -508,6 +540,7 @@ def prepare_request(next_link=None): 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) @@ -517,6 +550,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -534,7 +568,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]: @@ -547,7 +585,7 @@ def get_next(next_link=None): 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( @@ -566,6 +604,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -577,6 +617,7 @@ def prepare_request(next_link=None): 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) @@ -587,6 +628,7 @@ def prepare_request(next_link=None): 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) @@ -604,7 +646,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]: @@ -617,4 +663,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_snapshots_operations.py index 7ec89d09136e..46eb2770ecfe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_usage_operations.py index 009f6cbfb2df..e0fba0516b68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extension_images_operations.py index 1ac5371e5cd1..bfb81bc604a1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extensions_operations.py index 51f16f88cda2..9997c61c4297 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,9 +127,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -137,16 +138,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -160,10 +161,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -171,23 +173,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -200,33 +202,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,6 +269,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -275,6 +279,7 @@ def _create_or_update_initial( 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'], @@ -282,7 +287,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -300,7 +309,7 @@ def _create_or_update_initial( 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 @@ -338,8 +347,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,6 +362,7 @@ 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 @@ -376,10 +387,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -395,6 +405,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -404,6 +415,7 @@ def _update_initial( 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'], @@ -411,7 +423,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -425,7 +441,7 @@ def _update_initial( 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 @@ -463,8 +479,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,6 +494,7 @@ 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 @@ -501,12 +519,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -519,18 +536,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -540,11 +564,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -571,7 +595,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -583,6 +608,7 @@ 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 ) @@ -603,10 +629,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -625,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) @@ -638,19 +663,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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) - 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]: @@ -664,7 +696,7 @@ def get( 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 @@ -681,7 +713,7 @@ 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) @@ -694,18 +726,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -719,5 +758,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_images_operations.py index 12cfc2ae3d3c..e904886ea535 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_run_commands_operations.py index f4b968cd8886..009e309c302f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -65,31 +66,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -132,6 +134,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -143,6 +147,7 @@ def prepare_request(next_link=None): 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) @@ -153,6 +158,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -170,7 +176,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]: @@ -183,7 +193,7 @@ def get_next(next_link=None): 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( @@ -209,17 +219,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -233,5 +250,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_extensions_operations.py index a18d6592303b..6a6eea802bcd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,9 +82,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -92,16 +93,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -115,10 +116,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -126,23 +128,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -153,31 +155,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -217,6 +220,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -226,6 +230,7 @@ def _create_or_update_initial( 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'], @@ -233,7 +238,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -251,7 +260,7 @@ def _create_or_update_initial( 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 @@ -290,8 +299,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -304,6 +314,7 @@ 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 @@ -328,12 +339,11 @@ 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) + 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 + begin_create_or_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: str, vm_scale_set_name: str, @@ -346,18 +356,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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,11 +384,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -398,7 +415,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,6 +428,7 @@ 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 ) @@ -430,10 +449,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -452,7 +470,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) @@ -465,19 +483,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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) - 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]: @@ -491,7 +516,7 @@ def get( 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 @@ -514,6 +539,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -526,6 +553,7 @@ def prepare_request(next_link=None): 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) @@ -537,6 +565,7 @@ def prepare_request(next_link=None): 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) @@ -554,7 +583,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]: @@ -567,4 +600,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 4ed172a675bf..8f1836874040 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,25 +33,26 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -62,25 +63,26 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -91,31 +93,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -141,7 +144,7 @@ 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: str, vm_scale_set_name: str, @@ -153,17 +156,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -173,11 +183,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -201,7 +211,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -212,6 +223,7 @@ 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 ) @@ -232,12 +244,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -249,17 +260,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -269,11 +287,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -299,7 +317,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -310,6 +329,7 @@ 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 ) @@ -330,10 +350,9 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -359,17 +378,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -383,5 +409,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_vms_operations.py index e374f763ff12..9e0e84c16ec4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,9 +36,10 @@ def build_reimage_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -46,16 +47,16 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -67,9 +68,10 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -77,16 +79,16 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -98,9 +100,10 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -108,16 +111,16 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -132,12 +135,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -145,23 +148,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -175,9 +178,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -185,16 +189,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -206,10 +210,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -217,21 +222,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -243,10 +248,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-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') + _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'), @@ -254,21 +260,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,37 +289,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -325,9 +332,10 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -335,16 +343,16 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -356,9 +364,10 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -366,16 +375,16 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -387,9 +396,10 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -397,16 +407,16 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -418,9 +428,10 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -428,16 +439,16 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -449,9 +460,10 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -459,16 +471,16 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -483,12 +495,12 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -496,29 +508,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -540,7 +552,7 @@ 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: str, vm_scale_set_name: str, @@ -553,18 +565,25 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_reimage_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -574,11 +593,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -605,7 +624,8 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -617,6 +637,7 @@ def begin_reimage( 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 ) @@ -637,12 +658,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -655,18 +675,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -676,11 +703,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -708,7 +735,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -720,6 +748,7 @@ 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 ) @@ -740,12 +769,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -758,18 +786,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -779,11 +814,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -812,7 +847,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -824,6 +860,7 @@ 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 ) @@ -844,10 +881,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -863,6 +899,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -872,6 +909,7 @@ def _update_initial( 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'], @@ -879,7 +917,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -897,7 +939,7 @@ def _update_initial( 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 @@ -934,8 +976,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -948,6 +991,7 @@ 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 @@ -972,12 +1016,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -990,18 +1033,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1011,11 +1061,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1042,7 +1092,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1054,6 +1105,7 @@ def begin_delete( 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 ) @@ -1074,10 +1126,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1106,18 +1157,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1131,7 +1189,7 @@ def get( 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 @@ -1161,18 +1219,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -1186,7 +1251,7 @@ def get_instance_view( 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 @@ -1207,12 +1272,13 @@ 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 @@ -1221,6 +1287,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1233,6 +1301,7 @@ def prepare_request(next_link=None): 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, @@ -1247,6 +1316,7 @@ def prepare_request(next_link=None): 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, @@ -1267,7 +1337,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]: @@ -1280,9 +1354,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1295,18 +1369,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1316,11 +1397,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1349,7 +1430,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1361,6 +1443,7 @@ def begin_power_off( 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 ) @@ -1381,12 +1464,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1399,18 +1481,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1420,11 +1509,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1451,7 +1540,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1463,6 +1553,7 @@ 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 ) @@ -1483,12 +1574,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1501,18 +1591,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1522,11 +1619,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1553,7 +1650,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1565,6 +1663,7 @@ 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 ) @@ -1585,12 +1684,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1603,18 +1701,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1624,11 +1729,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1656,7 +1761,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1668,6 +1774,7 @@ 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 ) @@ -1688,12 +1795,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1706,18 +1812,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1727,11 +1840,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1758,7 +1871,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1770,6 +1884,7 @@ 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 ) @@ -1790,10 +1905,9 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore def _run_command_initial( self, @@ -1801,6 +1915,8 @@ 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"]] @@ -1809,7 +1925,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1818,6 +1934,7 @@ def _run_command_initial( 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'], @@ -1825,7 +1942,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1841,7 +1962,7 @@ def _run_command_initial( 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 @@ -1851,6 +1972,8 @@ def begin_run_command( 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. @@ -1863,6 +1986,9 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_04_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 @@ -1876,8 +2002,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-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( 'polling_interval', @@ -1891,6 +2017,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1914,7 +2041,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_sets_operations.py index db8e87e73818..d83a7c98ea93 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,31 +153,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,33 +192,33 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -232,33 +234,33 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -271,31 +273,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -305,30 +308,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -337,29 +341,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -370,31 +375,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -405,31 +411,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -443,33 +450,33 @@ def build_power_off_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -485,33 +492,33 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -527,33 +534,33 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -569,33 +576,33 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -611,33 +618,33 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -653,33 +660,33 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -695,33 +702,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -737,33 +744,33 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -778,36 +785,37 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -842,6 +850,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -850,6 +859,7 @@ def _create_or_update_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'], @@ -857,7 +867,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -875,7 +889,7 @@ def _create_or_update_initial( 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 @@ -908,8 +922,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -921,6 +936,7 @@ 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 @@ -945,10 +961,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -963,6 +978,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -971,6 +987,7 @@ def _update_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'], @@ -978,7 +995,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -992,7 +1013,7 @@ def _update_initial( 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 @@ -1025,8 +1046,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1038,6 +1060,7 @@ 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 @@ -1062,12 +1085,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1079,17 +1101,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1099,11 +1128,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1127,7 +1156,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1138,6 +1168,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -1158,10 +1189,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1187,17 +1217,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1211,10 +1248,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1227,6 +1264,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1238,6 +1276,7 @@ def _deallocate_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'], @@ -1245,7 +1284,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1255,11 +1298,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1274,7 +1317,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1289,8 +1333,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1302,6 +1347,7 @@ 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 @@ -1323,12 +1369,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1341,6 +1386,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1349,6 +1395,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1356,7 +1403,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1366,11 +1417,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1398,8 +1449,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1411,6 +1463,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1432,10 +1485,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1461,17 +1513,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -1485,7 +1544,7 @@ def get_instance_view( 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 @@ -1505,6 +1564,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1516,6 +1577,7 @@ def prepare_request(next_link=None): 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) @@ -1526,6 +1588,7 @@ def prepare_request(next_link=None): 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) @@ -1543,7 +1606,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]: @@ -1556,7 +1623,7 @@ def get_next(next_link=None): 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( @@ -1574,6 +1641,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1584,6 +1653,7 @@ def prepare_request(next_link=None): 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) @@ -1593,6 +1663,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1610,7 +1681,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]: @@ -1623,7 +1698,7 @@ def get_next(next_link=None): 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( @@ -1646,6 +1721,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1658,6 +1735,7 @@ def prepare_request(next_link=None): 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) @@ -1669,6 +1747,7 @@ def prepare_request(next_link=None): 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) @@ -1686,7 +1765,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]: @@ -1699,7 +1782,7 @@ def get_next(next_link=None): 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( @@ -1721,6 +1804,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1733,6 +1818,7 @@ def prepare_request(next_link=None): 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) @@ -1744,6 +1830,7 @@ def prepare_request(next_link=None): 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) @@ -1761,7 +1848,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]: @@ -1774,9 +1865,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1789,6 +1880,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1800,6 +1892,7 @@ def _power_off_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._power_off_initial.metadata['url'], @@ -1807,7 +1900,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1817,11 +1914,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1836,7 +1933,8 @@ def begin_power_off( :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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1851,8 +1949,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1864,6 +1963,7 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1885,12 +1985,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1903,6 +2002,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1914,6 +2014,7 @@ def _restart_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'], @@ -1921,7 +2022,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1931,11 +2036,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1948,7 +2053,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1963,8 +2069,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1976,6 +2083,7 @@ 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 @@ -1997,12 +2105,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2015,6 +2122,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2026,6 +2134,7 @@ def _start_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'], @@ -2033,7 +2142,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2043,11 +2156,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2060,7 +2173,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2075,8 +2189,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2088,6 +2203,7 @@ 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 @@ -2109,12 +2225,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2127,6 +2242,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2138,6 +2254,7 @@ def _redeploy_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'], @@ -2145,7 +2262,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2155,11 +2276,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2173,7 +2294,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2188,8 +2310,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2201,6 +2324,7 @@ 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 @@ -2222,12 +2346,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2240,6 +2363,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2251,6 +2375,7 @@ def _perform_maintenance_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'], @@ -2258,7 +2383,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2268,11 +2397,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2288,7 +2417,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2303,8 +2433,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2316,6 +2447,7 @@ 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 @@ -2337,12 +2469,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2355,6 +2486,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2363,6 +2495,7 @@ def _update_instances_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'], @@ -2370,7 +2503,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2380,11 +2517,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2412,8 +2549,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2425,6 +2563,7 @@ 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 @@ -2446,12 +2585,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2464,6 +2602,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2475,6 +2614,7 @@ def _reimage_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'], @@ -2482,7 +2622,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2492,11 +2636,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2509,7 +2653,8 @@ 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_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2524,8 +2669,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2537,6 +2683,7 @@ def begin_reimage( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -2558,12 +2705,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2576,6 +2722,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2587,6 +2734,7 @@ def _reimage_all_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'], @@ -2594,7 +2742,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2604,11 +2756,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2622,7 +2774,8 @@ 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. + :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.v2018_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2637,8 +2790,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2650,6 +2804,7 @@ 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 @@ -2671,10 +2826,9 @@ 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) + 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 + 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( @@ -2705,18 +2859,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -2730,5 +2891,5 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_sizes_operations.py index cd3b8ee70b2a..e24e29fc9159 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,6 +98,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -108,6 +111,7 @@ def prepare_request(next_link=None): 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) @@ -118,6 +122,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -135,7 +140,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]: @@ -148,4 +157,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machines_operations.py index 8c62fa904047..02913189e499 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -200,25 +201,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -231,33 +233,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -268,31 +271,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -303,25 +307,26 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -332,25 +337,26 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -361,25 +367,26 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -389,30 +396,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -421,29 +429,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -454,31 +463,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -489,25 +499,26 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -518,25 +529,26 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -547,25 +559,26 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -576,25 +589,26 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -605,25 +619,26 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-04-01" + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -637,41 +652,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-04-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -710,6 +725,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -721,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -731,6 +749,7 @@ def prepare_request(next_link=None): 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) @@ -748,7 +767,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]: @@ -761,7 +784,7 @@ def get_next(next_link=None): 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, @@ -776,6 +799,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -784,6 +808,7 @@ def _capture_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'], @@ -791,7 +816,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -807,7 +836,7 @@ def _capture_initial( 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 @@ -841,8 +870,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -854,6 +884,7 @@ 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 @@ -878,10 +909,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -896,6 +926,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -904,6 +935,7 @@ def _create_or_update_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'], @@ -911,7 +943,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -929,7 +965,7 @@ def _create_or_update_initial( 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 @@ -961,8 +997,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -974,6 +1011,7 @@ 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 @@ -998,10 +1036,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1016,6 +1053,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1024,6 +1062,7 @@ def _update_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'], @@ -1031,7 +1070,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1049,7 +1092,7 @@ def _update_initial( 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 @@ -1081,8 +1124,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1094,6 +1138,7 @@ 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 @@ -1118,12 +1163,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1135,17 +1179,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1155,11 +1206,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1183,7 +1234,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1194,6 +1246,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1214,10 +1267,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1233,8 +1285,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1247,18 +1299,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -1272,7 +1331,7 @@ def get( 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 @@ -1299,17 +1358,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: 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) - 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]: @@ -1323,10 +1389,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1338,17 +1404,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1358,11 +1431,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1387,7 +1460,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1398,6 +1472,7 @@ 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 ) @@ -1418,12 +1493,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1435,17 +1509,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1455,11 +1536,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1484,7 +1565,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1495,6 +1577,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1515,13 +1598,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1544,17 +1626,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -1564,7 +1653,7 @@ 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 @@ -1585,6 +1674,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1596,6 +1687,7 @@ def prepare_request(next_link=None): 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) @@ -1606,6 +1698,7 @@ def prepare_request(next_link=None): 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) @@ -1623,7 +1716,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]: @@ -1636,7 +1733,7 @@ def get_next(next_link=None): 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( @@ -1653,6 +1750,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1663,6 +1762,7 @@ def prepare_request(next_link=None): 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) @@ -1672,6 +1772,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1689,7 +1790,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]: @@ -1702,7 +1807,7 @@ def get_next(next_link=None): 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( @@ -1725,6 +1830,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1737,6 +1844,7 @@ def prepare_request(next_link=None): 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) @@ -1748,6 +1856,7 @@ def prepare_request(next_link=None): 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) @@ -1765,7 +1874,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]: @@ -1778,9 +1891,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -1792,17 +1905,24 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1812,11 +1932,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1841,7 +1961,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1852,6 +1973,7 @@ def begin_power_off( raw_result = self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1872,12 +1994,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1889,17 +2010,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -1909,11 +2037,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1937,7 +2065,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1948,6 +2077,7 @@ 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 ) @@ -1968,12 +2098,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1985,17 +2114,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -2005,11 +2141,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2033,7 +2169,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2044,6 +2181,7 @@ 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 ) @@ -2064,12 +2202,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2081,17 +2218,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -2101,11 +2245,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2129,7 +2273,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2140,6 +2285,7 @@ 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 ) @@ -2160,12 +2306,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2177,17 +2322,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + 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) - 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]: @@ -2197,11 +2349,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2225,7 +2377,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2236,6 +2389,7 @@ 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 ) @@ -2256,16 +2410,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore def _run_command_initial( self, resource_group_name: 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"]] @@ -2274,7 +2429,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-04-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2282,6 +2437,7 @@ def _run_command_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'], @@ -2289,7 +2445,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2305,7 +2465,7 @@ def _run_command_initial( 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 @@ -2314,6 +2474,8 @@ def begin_run_command( 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. @@ -2324,6 +2486,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_04_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 @@ -2337,8 +2502,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_04_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-04-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( 'polling_interval', @@ -2351,6 +2516,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2374,7 +2540,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_compute_management_client.py index 720217d8019b..1975d12ce50e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -85,8 +86,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-06-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. """ @@ -130,7 +134,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_configuration.py index 17c3fdcd80a7..685d31e430d2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2018-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-06-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_metadata.json index bdea49071c50..71d5b8cec4b5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_compute_management_client.py index cd064921d935..82dc2189549f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -86,8 +87,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-06-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_configuration.py index 7bd2f6908d49..6b24f8196865 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/_configuration.py @@ -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 "2018-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-06-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_availability_sets_operations.py index 7ccd2a7a1e58..ccc7c15f865f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_disks_operations.py index d4cfe5014986..16c645dea0ed 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_galleries_operations.py index d230c4eaaaf9..6382d5a792d4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -97,7 +102,7 @@ async def _create_or_update_initial( 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 @@ -130,8 +135,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ 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 @@ -167,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace_async async def get( @@ -196,17 +202,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -220,10 +233,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -235,17 +248,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -255,11 +275,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -283,7 +303,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -294,6 +315,7 @@ 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 ) @@ -314,10 +336,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -335,6 +356,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -346,6 +369,7 @@ def prepare_request(next_link=None): 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) @@ -356,6 +380,7 @@ def prepare_request(next_link=None): 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) @@ -373,7 +398,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]: @@ -386,7 +415,7 @@ async def get_next(next_link=None): 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( @@ -401,6 +430,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -411,6 +442,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -420,6 +452,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -437,7 +470,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]: @@ -450,4 +487,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_image_versions_operations.py index 4ae1bfaf60d3..11f9f5b33e34 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -146,8 +151,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -161,6 +167,7 @@ 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 @@ -185,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore @distributed_trace_async async def get( @@ -212,7 +218,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.v2018_06_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) @@ -225,6 +231,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -232,13 +240,18 @@ async def get( 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) - 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]: @@ -252,10 +265,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -269,6 +282,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -276,12 +291,17 @@ async def _delete_initial( 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) - 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]: @@ -291,11 +311,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -327,7 +347,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -340,6 +361,7 @@ 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 ) @@ -360,10 +382,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) + 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 + 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( @@ -390,6 +411,8 @@ def list_by_gallery_image( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -403,6 +426,7 @@ def prepare_request(next_link=None): 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) @@ -415,6 +439,7 @@ def prepare_request(next_link=None): 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) @@ -432,7 +457,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]: @@ -445,4 +474,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_images_operations.py index a7d3e03f096f..b06c76dff0da 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,6 +157,7 @@ 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 @@ -175,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace_async async def get( @@ -208,18 +214,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, + 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(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]: @@ -233,10 +246,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -249,18 +262,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -270,11 +290,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -302,7 +322,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -314,6 +335,7 @@ 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 ) @@ -334,10 +356,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -359,6 +380,8 @@ def list_by_gallery( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -371,6 +394,7 @@ def prepare_request(next_link=None): 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) @@ -382,6 +406,7 @@ def prepare_request(next_link=None): 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) @@ -399,7 +424,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]: @@ -412,4 +441,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_images_operations.py index 4e4e0e594a2a..0bbdf067f7bf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_log_analytics_operations.py index da066a7bc75a..7cadeaae4f08 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_operations.py index e802a452fe23..c7eae79ef24a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_proximity_placement_groups_operations.py index 44f3e669f066..aa987afcd09d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -239,17 +257,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -263,7 +288,7 @@ async def get( 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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) @@ -299,6 +327,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -316,7 +345,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]: @@ -329,7 +362,7 @@ async def get_next(next_link=None): 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( @@ -348,6 +381,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -359,6 +394,7 @@ def prepare_request(next_link=None): 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) @@ -369,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -386,7 +423,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]: @@ -399,4 +440,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_snapshots_operations.py index 3665216521b7..e45eb11a942e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_usage_operations.py index 27f3fbce0efe..72a931389d24 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extension_images_operations.py index 2b46f707ae8c..ee0bf71f0af8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extensions_operations.py index 7eb487c95f0b..d080473cce98 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_images_operations.py index a7d04265f9fe..ef72a86e5331 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_run_commands_operations.py index 06cd3ffeb3dd..fffa22da5359 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,7 +121,7 @@ async def get_next(next_link=None): 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( @@ -140,17 +147,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -164,5 +178,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index fa5e88150320..42e9f460cd39 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,12 +180,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -191,18 +197,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -212,11 +225,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -243,7 +256,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -255,6 +269,7 @@ 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 ) @@ -275,10 +290,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -297,7 +311,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) @@ -310,19 +324,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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) - 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]: @@ -336,7 +357,7 @@ async def get( 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 @@ -359,6 +380,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -371,6 +394,7 @@ def prepare_request(next_link=None): 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) @@ -382,6 +406,7 @@ def prepare_request(next_link=None): 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) @@ -399,7 +424,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]: @@ -412,4 +441,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 77ea0364a6c2..12f3c3ecf317 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,12 +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) + 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 + 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, @@ -252,17 +267,24 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -272,11 +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 @distributed_trace_async - async def begin_start_extension_upgrade( + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -302,7 +324,8 @@ async def begin_start_extension_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,6 +336,7 @@ 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 ) @@ -333,10 +357,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) + 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 + 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( @@ -362,17 +385,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -386,5 +416,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 2c19b9063075..7d8d8facb304 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -62,6 +61,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -74,6 +74,7 @@ async def _reimage_initial( 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'], @@ -81,7 +82,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -112,6 +117,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -126,8 +132,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +147,7 @@ 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 @@ -161,12 +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) + 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 + 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, @@ -179,18 +186,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -200,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -232,7 +246,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -244,6 +259,7 @@ 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 ) @@ -264,12 +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) + 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 + 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, @@ -282,18 +297,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -303,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,7 +358,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -348,6 +371,7 @@ 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 ) @@ -368,10 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -387,6 +410,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -396,6 +420,7 @@ async def _update_initial( 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'], @@ -403,7 +428,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -421,7 +450,7 @@ async def _update_initial( 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 @@ -458,8 +487,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +502,7 @@ 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 @@ -496,12 +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) + 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 + 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, @@ -514,18 +544,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -535,11 +572,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -566,7 +603,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -578,6 +616,7 @@ async def begin_delete( 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 ) @@ -598,10 +637,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -630,18 +668,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -655,7 +700,7 @@ async def get( 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 @@ -685,18 +730,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -710,7 +762,7 @@ async def get_instance_view( 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 @@ -731,12 +783,13 @@ 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 @@ -745,6 +798,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -757,6 +812,7 @@ def prepare_request(next_link=None): 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, @@ -771,6 +827,7 @@ def prepare_request(next_link=None): 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, @@ -791,7 +848,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]: @@ -804,9 +865,9 @@ async def get_next(next_link=None): 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, @@ -819,18 +880,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -840,11 +908,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -873,7 +941,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -885,6 +954,7 @@ async def begin_power_off( 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 ) @@ -905,12 +975,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -923,18 +992,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -944,11 +1020,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -975,7 +1051,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -987,6 +1064,7 @@ 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 ) @@ -1007,12 +1085,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1025,18 +1102,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1046,11 +1130,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1077,7 +1161,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1089,6 +1174,7 @@ 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 ) @@ -1109,12 +1195,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1127,18 +1212,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1148,11 +1240,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1180,7 +1272,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1192,6 +1285,7 @@ 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 ) @@ -1212,12 +1306,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1230,18 +1323,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1251,11 +1351,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1282,7 +1382,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1294,6 +1395,7 @@ 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 ) @@ -1314,10 +1416,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore async def _run_command_initial( self, @@ -1325,6 +1426,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"]] @@ -1333,7 +1436,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1342,6 +1445,7 @@ async def _run_command_initial( 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'], @@ -1349,7 +1453,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1365,7 +1473,7 @@ async def _run_command_initial( 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 @@ -1375,6 +1483,8 @@ async def begin_run_command( 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. @@ -1387,6 +1497,9 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_06_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 @@ -1401,8 +1514,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-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( 'polling_interval', @@ -1416,6 +1529,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1439,7 +1553,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_sets_operations.py index 162cfde0c5e5..52020c5d5d45 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -190,6 +197,7 @@ async def _update_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'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -211,7 +223,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -318,11 +338,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -406,17 +427,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,10 +458,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -446,6 +474,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -457,6 +486,7 @@ async def _deallocate_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'], @@ -464,7 +494,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -474,11 +508,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -493,7 +527,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -508,8 +543,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,6 +557,7 @@ 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 @@ -542,12 +579,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) + 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 + 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, @@ -560,6 +596,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -568,6 +605,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -575,7 +613,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -585,11 +627,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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -617,8 +659,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -630,6 +673,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -651,10 +695,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) + 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 + 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( @@ -680,17 +723,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -704,7 +754,7 @@ async def get_instance_view( 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 @@ -724,6 +774,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -735,6 +787,7 @@ def prepare_request(next_link=None): 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) @@ -745,6 +798,7 @@ def prepare_request(next_link=None): 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) @@ -762,7 +816,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]: @@ -775,7 +833,7 @@ async def get_next(next_link=None): 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( @@ -793,6 +851,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -803,6 +863,7 @@ def prepare_request(next_link=None): 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) @@ -812,6 +873,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -829,7 +891,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]: @@ -842,7 +908,7 @@ async def get_next(next_link=None): 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( @@ -865,6 +931,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -877,6 +945,7 @@ def prepare_request(next_link=None): 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) @@ -888,6 +957,7 @@ def prepare_request(next_link=None): 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) @@ -905,7 +975,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]: @@ -918,7 +992,7 @@ async def get_next(next_link=None): 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( @@ -940,6 +1014,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -952,6 +1028,7 @@ def prepare_request(next_link=None): 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) @@ -963,6 +1040,7 @@ def prepare_request(next_link=None): 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) @@ -980,7 +1058,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]: @@ -993,9 +1075,9 @@ async def get_next(next_link=None): 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, @@ -1008,6 +1090,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1019,6 +1102,7 @@ async def _power_off_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._power_off_initial.metadata['url'], @@ -1026,7 +1110,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1036,11 +1124,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1055,7 +1143,8 @@ async def begin_power_off( :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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1070,8 +1159,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1083,6 +1173,7 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1104,12 +1195,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) + 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 + 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, @@ -1122,6 +1212,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1133,6 +1224,7 @@ async def _restart_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'], @@ -1140,7 +1232,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1150,11 +1246,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1167,7 +1263,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1182,8 +1279,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1195,6 +1293,7 @@ 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 @@ -1216,12 +1315,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) + 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 + 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, @@ -1234,6 +1332,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1245,6 +1344,7 @@ async def _start_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'], @@ -1252,7 +1352,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1262,11 +1366,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1279,7 +1383,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1294,8 +1399,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,6 +1413,7 @@ 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 @@ -1328,12 +1435,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) + 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 + 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, @@ -1346,6 +1452,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1357,6 +1464,7 @@ async def _redeploy_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'], @@ -1364,7 +1472,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1374,11 +1486,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1392,7 +1504,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1407,8 +1520,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1420,6 +1534,7 @@ 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 @@ -1441,12 +1556,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1459,6 +1573,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1470,6 +1585,7 @@ async def _perform_maintenance_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'], @@ -1477,7 +1593,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1487,11 +1607,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1507,7 +1627,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1522,8 +1643,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1535,6 +1657,7 @@ 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 @@ -1556,12 +1679,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1574,6 +1696,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1582,6 +1705,7 @@ async def _update_instances_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'], @@ -1589,7 +1713,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1599,11 +1727,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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1631,8 +1759,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1644,6 +1773,7 @@ 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 @@ -1665,12 +1795,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) + 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 + 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, @@ -1683,6 +1812,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -1694,6 +1824,7 @@ async def _reimage_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'], @@ -1701,7 +1832,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1711,11 +1846,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1730,7 +1865,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -1745,8 +1880,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1758,6 +1894,7 @@ 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 @@ -1779,12 +1916,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1797,6 +1933,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1808,6 +1945,7 @@ async def _reimage_all_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'], @@ -1815,7 +1953,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1825,11 +1967,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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1843,7 +1985,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1858,8 +2001,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1871,6 +2015,7 @@ 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 @@ -1892,10 +2037,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) + 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 + 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( @@ -1926,18 +2070,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -1951,5 +2102,5 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_sizes_operations.py index 42d0d0741d61..1fcf0b5f4155 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -64,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -85,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -102,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]: @@ -115,4 +121,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machines_operations.py index fa0bcd9917bb..c148071aad0d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -317,8 +337,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -330,6 +351,7 @@ 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 @@ -354,10 +376,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -372,6 +393,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -380,6 +402,7 @@ async def _update_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'], @@ -387,7 +410,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -405,7 +432,7 @@ async def _update_initial( 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 @@ -438,8 +465,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -451,6 +479,7 @@ 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 @@ -475,12 +504,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) + 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 + 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, @@ -492,17 +520,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -512,11 +547,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -540,7 +575,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -551,6 +587,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -571,10 +608,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -590,8 +626,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -604,18 +640,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -629,7 +672,7 @@ async def get( 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 @@ -656,17 +699,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -680,10 +730,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -695,17 +745,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -715,11 +772,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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -744,7 +801,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -755,6 +813,7 @@ 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 ) @@ -775,12 +834,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) + 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 + 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, @@ -792,17 +850,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -812,11 +877,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -841,7 +906,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -852,6 +918,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -872,13 +939,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -901,17 +967,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -921,7 +994,7 @@ 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 @@ -942,6 +1015,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -953,6 +1028,7 @@ def prepare_request(next_link=None): 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) @@ -963,6 +1039,7 @@ def prepare_request(next_link=None): 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) @@ -980,7 +1057,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]: @@ -993,7 +1074,7 @@ async def get_next(next_link=None): 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( @@ -1010,6 +1091,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1020,6 +1103,7 @@ def prepare_request(next_link=None): 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) @@ -1029,6 +1113,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1046,7 +1131,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]: @@ -1059,7 +1148,7 @@ async def get_next(next_link=None): 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( @@ -1082,6 +1171,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1094,6 +1185,7 @@ def prepare_request(next_link=None): 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) @@ -1105,6 +1197,7 @@ def prepare_request(next_link=None): 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) @@ -1122,7 +1215,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]: @@ -1135,9 +1232,9 @@ async def get_next(next_link=None): 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, @@ -1149,17 +1246,24 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1169,11 +1273,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1198,7 +1302,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1209,6 +1314,7 @@ async def begin_power_off( raw_result = await self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1229,12 +1335,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1246,17 +1351,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -1266,11 +1378,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1294,7 +1406,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1305,6 +1418,7 @@ 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 ) @@ -1325,12 +1439,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) + 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 + 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, @@ -1342,17 +1455,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -1362,11 +1482,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1390,7 +1510,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1401,6 +1522,7 @@ 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 ) @@ -1421,12 +1543,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) + 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 + 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, @@ -1438,17 +1559,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -1458,11 +1586,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1486,7 +1614,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1497,6 +1626,7 @@ 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 ) @@ -1517,12 +1647,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) + 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 + 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, @@ -1535,6 +1664,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1546,6 +1676,7 @@ async def _reimage_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'], @@ -1553,7 +1684,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1563,11 +1698,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1580,7 +1715,8 @@ 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.v2018_06_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1594,8 +1730,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1607,6 +1744,7 @@ 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 @@ -1628,12 +1766,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1645,17 +1782,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -1665,11 +1809,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1693,7 +1837,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1704,6 +1849,7 @@ 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 ) @@ -1724,16 +1870,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # 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"]] @@ -1742,7 +1889,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1750,6 +1897,7 @@ async def _run_command_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'], @@ -1757,7 +1905,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1773,7 +1925,7 @@ async def _run_command_initial( 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 @@ -1782,6 +1934,8 @@ async def begin_run_command( 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. @@ -1792,6 +1946,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_06_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 @@ -1806,8 +1963,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_06_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-06-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( 'polling_interval', @@ -1820,6 +1977,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1843,7 +2001,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_availability_sets_operations.py index 084aba231039..b753db0aa095 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -185,31 +187,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -253,31 +257,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,6 +335,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -338,6 +344,7 @@ def create_or_update( 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'], @@ -345,7 +352,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -359,7 +370,7 @@ def create_or_update( 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 @@ -389,6 +400,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -397,6 +409,7 @@ def update( 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'], @@ -404,7 +417,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +435,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -445,17 +462,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -465,7 +489,7 @@ 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 @@ -492,17 +516,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -516,7 +547,7 @@ def get( 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 @@ -528,7 +559,7 @@ 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 @@ -537,6 +568,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -547,6 +580,7 @@ def prepare_request(next_link=None): 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'], ) @@ -557,6 +591,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -575,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]: @@ -588,7 +627,7 @@ def get_next(next_link=None): 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( @@ -607,6 +646,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -618,6 +659,7 @@ def prepare_request(next_link=None): 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) @@ -628,6 +670,7 @@ def prepare_request(next_link=None): 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) @@ -645,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]: @@ -658,7 +705,7 @@ def get_next(next_link=None): 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( @@ -681,6 +728,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_disks_operations.py index 8ec07425e0a6..fa3f3c4bbadb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_galleries_operations.py index 63bd638b4ce9..5ad8fd11b171 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -79,31 +79,32 @@ def build_get_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -114,31 +115,32 @@ def build_delete_request_initial( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -148,30 +150,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -180,29 +183,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -241,6 +245,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -249,6 +254,7 @@ def _create_or_update_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'], @@ -256,7 +262,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -277,7 +287,7 @@ def _create_or_update_initial( 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 @@ -309,8 +319,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -322,6 +333,7 @@ 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 @@ -346,10 +358,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def get( @@ -375,17 +386,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -399,10 +417,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -414,17 +432,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -434,11 +459,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -462,7 +487,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -473,6 +499,7 @@ 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 ) @@ -493,10 +520,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -513,6 +539,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -524,6 +552,7 @@ def prepare_request(next_link=None): 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) @@ -534,6 +563,7 @@ def prepare_request(next_link=None): 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) @@ -551,7 +581,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]: @@ -564,7 +598,7 @@ def get_next(next_link=None): 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( @@ -578,6 +612,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -588,6 +624,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -597,6 +634,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -614,7 +652,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]: @@ -627,4 +669,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_image_versions_operations.py index ce7037a67c1f..89ea53809f99 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -87,10 +87,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-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}') + _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'), @@ -99,23 +100,23 @@ def build_get_request( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -128,10 +129,11 @@ def build_delete_request_initial( gallery_image_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-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}') + _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'), @@ -140,21 +142,21 @@ def build_delete_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,10 +168,11 @@ def build_list_by_gallery_image_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-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') + _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'), @@ -177,21 +180,21 @@ def build_list_by_gallery_image_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -232,6 +235,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -242,6 +246,7 @@ def _create_or_update_initial( 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'], @@ -249,7 +254,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -270,7 +279,7 @@ def _create_or_update_initial( 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 @@ -315,8 +324,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -330,6 +340,7 @@ 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 @@ -354,10 +365,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore @distributed_trace def get( @@ -381,7 +391,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.v2018_06_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) @@ -394,6 +404,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -401,13 +413,18 @@ def get( 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) - 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]: @@ -421,10 +438,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -438,6 +455,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -445,12 +464,17 @@ def _delete_initial( 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) - 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]: @@ -460,11 +484,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -496,7 +520,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -509,6 +534,7 @@ 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 ) @@ -529,10 +555,9 @@ 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) + 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 + 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( @@ -559,6 +584,8 @@ def list_by_gallery_image( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -572,6 +599,7 @@ def prepare_request(next_link=None): 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) @@ -584,6 +612,7 @@ def prepare_request(next_link=None): 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) @@ -601,7 +630,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]: @@ -614,4 +647,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_images_operations.py index fe2751497e1f..924f5f7bea22 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,10 +82,11 @@ def build_get_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -93,21 +94,21 @@ def build_get_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -119,10 +120,11 @@ def build_delete_request_initial( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -130,21 +132,21 @@ def build_delete_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,31 +157,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,6 +222,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -228,6 +232,7 @@ def _create_or_update_initial( 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'], @@ -235,7 +240,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -256,7 +265,7 @@ def _create_or_update_initial( 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 @@ -294,8 +303,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -308,6 +318,7 @@ 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 @@ -332,10 +343,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def get( @@ -365,18 +375,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, + 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(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,10 +407,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -406,18 +423,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -427,11 +451,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -459,7 +483,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -471,6 +496,7 @@ 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 ) @@ -491,10 +517,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -515,6 +540,8 @@ def list_by_gallery( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -527,6 +554,7 @@ def prepare_request(next_link=None): 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) @@ -538,6 +566,7 @@ def prepare_request(next_link=None): 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) @@ -555,7 +584,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]: @@ -568,4 +601,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_images_operations.py index 726352f47262..0a768f1e99b2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -154,33 +155,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -291,6 +296,7 @@ def _create_or_update_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'], @@ -298,7 +304,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -316,7 +326,7 @@ def _create_or_update_initial( 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 @@ -347,8 +357,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -360,6 +371,7 @@ 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 @@ -384,10 +396,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -402,6 +413,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -410,6 +422,7 @@ def _update_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'], @@ -417,7 +430,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -435,7 +452,7 @@ def _update_initial( 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 @@ -466,8 +483,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +497,7 @@ 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 @@ -503,12 +522,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -520,17 +538,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -540,11 +565,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -568,7 +593,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,6 +605,7 @@ 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 ) @@ -599,10 +626,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -618,7 +644,7 @@ 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) @@ -631,18 +657,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -656,7 +689,7 @@ def get( 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 @@ -674,6 +707,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -685,6 +720,7 @@ def prepare_request(next_link=None): 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) @@ -695,6 +731,7 @@ def prepare_request(next_link=None): 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) @@ -712,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]: @@ -725,7 +766,7 @@ def get_next(next_link=None): 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( @@ -740,6 +781,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -750,6 +793,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -759,6 +803,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -776,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]: @@ -789,4 +838,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_log_analytics_operations.py index ec49c4a671a5..b07c4e01d46c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_operations.py index 08bbccf8c71d..cc071fe501c6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_proximity_placement_groups_operations.py index 701c2018eb01..74c689442f1d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,29 +185,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,30 +218,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -291,6 +295,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -299,6 +304,7 @@ def create_or_update( 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'], @@ -306,7 +312,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -324,7 +334,7 @@ def create_or_update( 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 @@ -354,6 +364,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -362,6 +373,7 @@ def update( 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'], @@ -369,7 +381,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -383,11 +399,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -410,17 +426,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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,7 +453,7 @@ 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 @@ -457,17 +480,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -481,7 +511,7 @@ def get( 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 @@ -498,6 +528,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -508,6 +540,7 @@ def prepare_request(next_link=None): 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) @@ -517,6 +550,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -534,7 +568,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]: @@ -547,7 +585,7 @@ def get_next(next_link=None): 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( @@ -566,6 +604,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -577,6 +617,7 @@ def prepare_request(next_link=None): 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) @@ -587,6 +628,7 @@ def prepare_request(next_link=None): 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) @@ -604,7 +646,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]: @@ -617,4 +663,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_snapshots_operations.py index 91c85efd8815..b87a34df6284 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_usage_operations.py index ffe0c2a514f1..7251a81a81d2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extension_images_operations.py index 3691c4479061..26c51b789f6b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extensions_operations.py index 50b1b08d7775..8274a5098868 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,9 +127,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -137,16 +138,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -160,10 +161,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -171,23 +173,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -200,33 +202,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,6 +269,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -275,6 +279,7 @@ def _create_or_update_initial( 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'], @@ -282,7 +287,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -300,7 +309,7 @@ def _create_or_update_initial( 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 @@ -338,8 +347,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,6 +362,7 @@ 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 @@ -376,10 +387,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -395,6 +405,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -404,6 +415,7 @@ def _update_initial( 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'], @@ -411,7 +423,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -425,7 +441,7 @@ def _update_initial( 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 @@ -463,8 +479,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,6 +494,7 @@ 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 @@ -501,12 +519,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -519,18 +536,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -540,11 +564,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -571,7 +595,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -583,6 +608,7 @@ 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 ) @@ -603,10 +629,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -625,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) @@ -638,19 +663,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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) - 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]: @@ -664,7 +696,7 @@ def get( 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 @@ -681,7 +713,7 @@ 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) @@ -694,18 +726,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -719,5 +758,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_images_operations.py index 257030e006b7..c0e5f3969649 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_run_commands_operations.py index dbfd10833ae4..544ce6d44e7f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -65,31 +66,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -132,6 +134,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -143,6 +147,7 @@ def prepare_request(next_link=None): 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) @@ -153,6 +158,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -170,7 +176,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]: @@ -183,7 +193,7 @@ def get_next(next_link=None): 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( @@ -209,17 +219,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -233,5 +250,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_extensions_operations.py index 594988e7e171..3fbe19d39143 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,9 +82,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -92,16 +93,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -115,10 +116,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -126,23 +128,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -153,31 +155,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -217,6 +220,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -226,6 +230,7 @@ def _create_or_update_initial( 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'], @@ -233,7 +238,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -251,7 +260,7 @@ def _create_or_update_initial( 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 @@ -290,8 +299,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -304,6 +314,7 @@ 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 @@ -328,12 +339,11 @@ 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) + 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 + begin_create_or_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: str, vm_scale_set_name: str, @@ -346,18 +356,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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,11 +384,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -398,7 +415,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,6 +428,7 @@ 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 ) @@ -430,10 +449,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -452,7 +470,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) @@ -465,19 +483,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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) - 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]: @@ -491,7 +516,7 @@ def get( 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 @@ -514,6 +539,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -526,6 +553,7 @@ def prepare_request(next_link=None): 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) @@ -537,6 +565,7 @@ def prepare_request(next_link=None): 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) @@ -554,7 +583,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]: @@ -567,4 +600,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 94da44414cc6..6e237a0ee0a4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,25 +33,26 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -62,25 +63,26 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -91,25 +93,26 @@ def build_start_extension_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -120,31 +123,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -170,7 +174,7 @@ 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: str, vm_scale_set_name: str, @@ -182,17 +186,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -202,11 +213,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -230,7 +241,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -241,6 +253,7 @@ 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 ) @@ -261,12 +274,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -278,17 +290,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,11 +317,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -328,7 +347,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -339,6 +359,7 @@ 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 ) @@ -359,12 +380,11 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def _start_extension_upgrade_initial( + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -376,17 +396,24 @@ def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -396,11 +423,11 @@ 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 @distributed_trace - def begin_start_extension_upgrade( + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -426,7 +453,8 @@ def begin_start_extension_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -437,6 +465,7 @@ 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 ) @@ -457,10 +486,9 @@ 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) + 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 + begin_start_extension_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -486,17 +514,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -510,5 +545,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_vms_operations.py index 5c80b9c27b6b..4e0c6a16b075 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,11 +39,11 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -51,22 +51,22 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,9 +80,10 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -90,16 +91,16 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -111,9 +112,10 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -121,16 +123,16 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -145,12 +147,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -158,23 +160,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -188,9 +190,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -198,16 +201,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -219,10 +222,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -230,21 +234,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -256,10 +260,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-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') + _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'), @@ -267,21 +272,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -296,37 +301,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -338,9 +344,10 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -348,16 +355,16 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -369,9 +376,10 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -379,16 +387,16 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -400,9 +408,10 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -410,16 +419,16 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -431,9 +440,10 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -441,16 +451,16 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -462,9 +472,10 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -472,16 +483,16 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -496,12 +507,12 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -509,29 +520,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -553,7 +564,7 @@ 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: str, vm_scale_set_name: str, @@ -567,6 +578,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -579,6 +591,7 @@ def _reimage_initial( 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'], @@ -586,7 +599,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -596,11 +613,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -617,6 +634,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -631,8 +649,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -645,6 +664,7 @@ 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 @@ -666,12 +686,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -684,18 +703,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -705,11 +731,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -737,7 +763,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -749,6 +776,7 @@ 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 ) @@ -769,12 +797,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -787,18 +814,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -808,11 +842,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -841,7 +875,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -853,6 +888,7 @@ 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 ) @@ -873,10 +909,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -892,6 +927,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -901,6 +937,7 @@ def _update_initial( 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'], @@ -908,7 +945,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -926,7 +967,7 @@ def _update_initial( 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 @@ -963,8 +1004,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -977,6 +1019,7 @@ 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 @@ -1001,12 +1044,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1019,18 +1061,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1040,11 +1089,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1071,7 +1120,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1083,6 +1133,7 @@ def begin_delete( 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 ) @@ -1103,10 +1154,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1135,18 +1185,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1160,7 +1217,7 @@ def get( 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 @@ -1190,18 +1247,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -1215,7 +1279,7 @@ def get_instance_view( 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 @@ -1236,12 +1300,13 @@ 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 @@ -1250,6 +1315,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1262,6 +1329,7 @@ def prepare_request(next_link=None): 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, @@ -1276,6 +1344,7 @@ def prepare_request(next_link=None): 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, @@ -1296,7 +1365,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]: @@ -1309,9 +1382,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1324,18 +1397,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1345,11 +1425,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1378,7 +1458,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1390,6 +1471,7 @@ def begin_power_off( 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 ) @@ -1410,12 +1492,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1428,18 +1509,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1449,11 +1537,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1480,7 +1568,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1492,6 +1581,7 @@ 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 ) @@ -1512,12 +1602,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1530,18 +1619,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1551,11 +1647,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1582,7 +1678,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1594,6 +1691,7 @@ 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 ) @@ -1614,12 +1712,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1632,18 +1729,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1653,11 +1757,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1685,7 +1789,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1697,6 +1802,7 @@ 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 ) @@ -1717,12 +1823,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1735,18 +1840,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1756,11 +1868,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1787,7 +1899,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1799,6 +1912,7 @@ 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 ) @@ -1819,10 +1933,9 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore def _run_command_initial( self, @@ -1830,6 +1943,8 @@ 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"]] @@ -1838,7 +1953,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1847,6 +1962,7 @@ def _run_command_initial( 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'], @@ -1854,7 +1970,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1870,7 +1990,7 @@ def _run_command_initial( 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 @@ -1880,6 +2000,8 @@ def begin_run_command( 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. @@ -1892,6 +2014,9 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_06_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 @@ -1905,8 +2030,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-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( 'polling_interval', @@ -1920,6 +2045,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1943,7 +2069,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_sets_operations.py index d4cb56f21640..65532d55a824 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,31 +153,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,33 +192,33 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -232,33 +234,33 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -271,31 +273,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -305,30 +308,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -337,29 +341,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -370,31 +375,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -405,31 +411,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -443,33 +450,33 @@ def build_power_off_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -485,33 +492,33 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -527,33 +534,33 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -569,33 +576,33 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -611,33 +618,33 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -653,33 +660,33 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -695,33 +702,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -737,33 +744,33 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -778,36 +785,37 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -842,6 +850,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -850,6 +859,7 @@ def _create_or_update_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'], @@ -857,7 +867,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -875,7 +889,7 @@ def _create_or_update_initial( 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 @@ -908,8 +922,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -921,6 +936,7 @@ 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 @@ -945,10 +961,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -963,6 +978,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -971,6 +987,7 @@ def _update_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'], @@ -978,7 +995,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -992,7 +1013,7 @@ def _update_initial( 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 @@ -1025,8 +1046,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1038,6 +1060,7 @@ 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 @@ -1062,12 +1085,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1079,17 +1101,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1099,11 +1128,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1127,7 +1156,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1138,6 +1168,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -1158,10 +1189,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1187,17 +1217,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1211,10 +1248,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1227,6 +1264,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1238,6 +1276,7 @@ def _deallocate_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'], @@ -1245,7 +1284,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1255,11 +1298,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1274,7 +1317,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1289,8 +1333,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1302,6 +1347,7 @@ 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 @@ -1323,12 +1369,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1341,6 +1386,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1349,6 +1395,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1356,7 +1403,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1366,11 +1417,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1398,8 +1449,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1411,6 +1463,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1432,10 +1485,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1461,17 +1513,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -1485,7 +1544,7 @@ def get_instance_view( 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 @@ -1505,6 +1564,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1516,6 +1577,7 @@ def prepare_request(next_link=None): 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) @@ -1526,6 +1588,7 @@ def prepare_request(next_link=None): 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) @@ -1543,7 +1606,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]: @@ -1556,7 +1623,7 @@ def get_next(next_link=None): 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( @@ -1574,6 +1641,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1584,6 +1653,7 @@ def prepare_request(next_link=None): 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) @@ -1593,6 +1663,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1610,7 +1681,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]: @@ -1623,7 +1698,7 @@ def get_next(next_link=None): 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( @@ -1646,6 +1721,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1658,6 +1735,7 @@ def prepare_request(next_link=None): 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) @@ -1669,6 +1747,7 @@ def prepare_request(next_link=None): 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) @@ -1686,7 +1765,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]: @@ -1699,7 +1782,7 @@ def get_next(next_link=None): 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( @@ -1721,6 +1804,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1733,6 +1818,7 @@ def prepare_request(next_link=None): 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) @@ -1744,6 +1830,7 @@ def prepare_request(next_link=None): 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) @@ -1761,7 +1848,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]: @@ -1774,9 +1865,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1789,6 +1880,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1800,6 +1892,7 @@ def _power_off_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._power_off_initial.metadata['url'], @@ -1807,7 +1900,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1817,11 +1914,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1836,7 +1933,8 @@ def begin_power_off( :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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1851,8 +1949,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1864,6 +1963,7 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1885,12 +1985,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1903,6 +2002,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1914,6 +2014,7 @@ def _restart_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'], @@ -1921,7 +2022,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1931,11 +2036,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1948,7 +2053,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1963,8 +2069,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1976,6 +2083,7 @@ 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 @@ -1997,12 +2105,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2015,6 +2122,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2026,6 +2134,7 @@ def _start_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'], @@ -2033,7 +2142,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2043,11 +2156,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2060,7 +2173,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2075,8 +2189,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2088,6 +2203,7 @@ 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 @@ -2109,12 +2225,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2127,6 +2242,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2138,6 +2254,7 @@ def _redeploy_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'], @@ -2145,7 +2262,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2155,11 +2276,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2173,7 +2294,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2188,8 +2310,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2201,6 +2324,7 @@ 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 @@ -2222,12 +2346,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2240,6 +2363,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2251,6 +2375,7 @@ def _perform_maintenance_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'], @@ -2258,7 +2383,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2268,11 +2397,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2288,7 +2417,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2303,8 +2433,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2316,6 +2447,7 @@ 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 @@ -2337,12 +2469,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2355,6 +2486,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2363,6 +2495,7 @@ def _update_instances_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'], @@ -2370,7 +2503,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2380,11 +2517,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2412,8 +2549,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2425,6 +2563,7 @@ 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 @@ -2446,12 +2585,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2464,6 +2602,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -2475,6 +2614,7 @@ def _reimage_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'], @@ -2482,7 +2622,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2492,11 +2636,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2511,7 +2655,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2018_06_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -2526,8 +2670,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2539,6 +2684,7 @@ 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 @@ -2560,12 +2706,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2578,6 +2723,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2589,6 +2735,7 @@ def _reimage_all_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'], @@ -2596,7 +2743,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2606,11 +2757,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2624,7 +2775,8 @@ 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. + :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.v2018_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2639,8 +2791,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2652,6 +2805,7 @@ 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 @@ -2673,10 +2827,9 @@ 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) + 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 + 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( @@ -2707,18 +2860,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -2732,5 +2892,5 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_sizes_operations.py index 1acd875e5c15..764c956d710c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,6 +99,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -109,6 +112,7 @@ def prepare_request(next_link=None): 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) @@ -119,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machines_operations.py index 0e33c0cad4a5..af466f777ccb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -200,25 +201,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -231,33 +233,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -268,31 +271,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -303,25 +307,26 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -332,25 +337,26 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -361,25 +367,26 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -389,30 +396,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -421,29 +429,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -454,31 +463,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -489,25 +499,26 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -518,25 +529,26 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -547,25 +559,26 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -576,25 +589,26 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -608,33 +622,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -647,25 +661,26 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-06-01" + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -679,41 +694,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-06-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -752,6 +767,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -763,6 +780,7 @@ def prepare_request(next_link=None): 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) @@ -773,6 +791,7 @@ def prepare_request(next_link=None): 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) @@ -790,7 +809,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]: @@ -803,7 +826,7 @@ def get_next(next_link=None): 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, @@ -818,6 +841,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -826,6 +850,7 @@ def _capture_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'], @@ -833,7 +858,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -849,7 +878,7 @@ def _capture_initial( 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 @@ -883,8 +912,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -896,6 +926,7 @@ 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 @@ -920,10 +951,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -938,6 +968,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -946,6 +977,7 @@ def _create_or_update_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'], @@ -953,7 +985,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -971,7 +1007,7 @@ def _create_or_update_initial( 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 @@ -1003,8 +1039,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1016,6 +1053,7 @@ 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 @@ -1040,10 +1078,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1058,6 +1095,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1066,6 +1104,7 @@ def _update_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'], @@ -1073,7 +1112,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1091,7 +1134,7 @@ def _update_initial( 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 @@ -1123,8 +1166,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1136,6 +1180,7 @@ 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 @@ -1160,12 +1205,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1177,17 +1221,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1197,11 +1248,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1225,7 +1276,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1236,6 +1288,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1256,10 +1309,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1275,8 +1327,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1289,18 +1341,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -1314,7 +1373,7 @@ def get( 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 @@ -1341,17 +1400,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: 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) - 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]: @@ -1365,10 +1431,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1380,17 +1446,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1400,11 +1473,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1429,7 +1502,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1440,6 +1514,7 @@ 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 ) @@ -1460,12 +1535,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1477,17 +1551,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1497,11 +1578,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1526,7 +1607,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1537,6 +1619,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1557,13 +1640,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1586,17 +1668,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -1606,7 +1695,7 @@ 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 @@ -1627,6 +1716,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1638,6 +1729,7 @@ def prepare_request(next_link=None): 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) @@ -1648,6 +1740,7 @@ def prepare_request(next_link=None): 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) @@ -1665,7 +1758,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]: @@ -1678,7 +1775,7 @@ def get_next(next_link=None): 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( @@ -1695,6 +1792,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1705,6 +1804,7 @@ def prepare_request(next_link=None): 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) @@ -1714,6 +1814,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1731,7 +1832,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]: @@ -1744,7 +1849,7 @@ def get_next(next_link=None): 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( @@ -1767,6 +1872,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1779,6 +1886,7 @@ def prepare_request(next_link=None): 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) @@ -1790,6 +1898,7 @@ def prepare_request(next_link=None): 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) @@ -1807,7 +1916,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]: @@ -1820,9 +1933,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -1834,17 +1947,24 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1854,11 +1974,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1883,7 +2003,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1894,6 +2015,7 @@ def begin_power_off( raw_result = self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1914,12 +2036,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1931,17 +2052,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -1951,11 +2079,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1979,7 +2107,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1990,6 +2119,7 @@ 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 ) @@ -2010,12 +2140,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2027,17 +2156,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -2047,11 +2183,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2075,7 +2211,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2086,6 +2223,7 @@ 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 ) @@ -2106,12 +2244,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2123,17 +2260,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -2143,11 +2287,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2171,7 +2315,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2182,6 +2327,7 @@ 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 ) @@ -2202,12 +2348,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2220,6 +2365,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -2231,6 +2377,7 @@ def _reimage_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'], @@ -2238,7 +2385,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2248,11 +2399,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2265,7 +2416,8 @@ 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.v2018_06_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2279,8 +2431,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2292,6 +2445,7 @@ 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 @@ -2313,12 +2467,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2330,17 +2483,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + 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) - 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]: @@ -2350,11 +2510,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2378,7 +2538,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2389,6 +2550,7 @@ 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 ) @@ -2409,16 +2571,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore def _run_command_initial( self, resource_group_name: 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"]] @@ -2427,7 +2590,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-06-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2435,6 +2598,7 @@ def _run_command_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'], @@ -2442,7 +2606,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2458,7 +2626,7 @@ def _run_command_initial( 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 @@ -2467,6 +2635,8 @@ def begin_run_command( 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. @@ -2477,6 +2647,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_06_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 @@ -2490,8 +2663,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_06_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-06-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( 'polling_interval', @@ -2504,6 +2677,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2527,7 +2701,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_compute_management_client.py index b869582e36ed..9cbcc322a437 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -33,8 +34,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-09-30". 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. """ @@ -59,7 +63,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_configuration.py index 78cb4312784f..91e3b964d8ac 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2018-09-30". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-09-30" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_metadata.json index 20bebc08e9ab..9a5cb14ed0d3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_compute_management_client.py index 0a9753eb1e1a..d2a9bc767bd0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -33,8 +34,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-09-30". 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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_configuration.py index fa2921f5507e..498632f970cf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/_configuration.py @@ -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 "2018-09-30". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-09-30" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_disks_operations.py index ce0855669592..a3a24661afd6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_snapshots_operations.py index 5fa128adae6f..8be3218d5075 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_09_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_disks_operations.py index 195524efe0cb..39fa2f95180c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-30" + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-30" + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-30" + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-30" + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-30" + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_snapshots_operations.py index 0c541d80104c..faa8c18d56fc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_09_30/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-30" + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-30" + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-30" + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-30" + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-09-30" + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_09_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_compute_management_client.py index 583b8227f815..0114600695eb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -74,8 +75,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -114,7 +118,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_configuration.py index c3b4011ce0c3..e0d3bc1e9925 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2018-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-10-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_metadata.json index 4a2c35baf339..1f1b743fd9d0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_compute_management_client.py index 797c3f82a457..c0eff11afec0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -75,8 +76,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2018-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_configuration.py index 4687bc87ae22..da8e7374c0ea 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/_configuration.py @@ -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 "2018-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-10-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_availability_sets_operations.py index 8e6cfdabbed9..71272f2f5ed7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_images_operations.py index ec57c9cb18a3..00a16ba8ebeb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_log_analytics_operations.py index 02e2a3018abf..3c322cbb9b58 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_operations.py index ca44e7dab931..e877dee70e26 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_proximity_placement_groups_operations.py index 4a31c3aeca9e..8a3f5e06c396 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -239,17 +257,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -263,7 +288,7 @@ async def get( 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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) @@ -299,6 +327,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -316,7 +345,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]: @@ -329,7 +362,7 @@ async def get_next(next_link=None): 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( @@ -348,6 +381,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -359,6 +394,7 @@ def prepare_request(next_link=None): 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) @@ -369,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -386,7 +423,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]: @@ -399,4 +440,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_usage_operations.py index 97340783b967..679246a4d157 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extension_images_operations.py index 2d9df4aef4d8..65d03af2fa16 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extensions_operations.py index 4f5f2ffddfae..e4d90aaf7f80 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_images_operations.py index 6fd4e5968a6d..f7eb5a1ac550 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_run_commands_operations.py index 275097a8322e..0c0c6036b2a8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,7 +121,7 @@ async def get_next(next_link=None): 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( @@ -140,17 +147,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -164,5 +178,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index a2684e4cacc0..164d59429d0c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,12 +180,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -191,18 +197,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -212,11 +225,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -243,7 +256,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -255,6 +269,7 @@ 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 ) @@ -275,10 +290,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -297,7 +311,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) @@ -310,19 +324,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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) - 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]: @@ -336,7 +357,7 @@ async def get( 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 @@ -359,6 +380,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -371,6 +394,7 @@ def prepare_request(next_link=None): 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) @@ -382,6 +406,7 @@ def prepare_request(next_link=None): 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) @@ -399,7 +424,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]: @@ -412,4 +441,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 400542a7aad3..ef6b21d7d827 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,12 +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) + 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 + 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, @@ -252,17 +267,24 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -272,11 +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 @distributed_trace_async - async def begin_start_extension_upgrade( + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -302,7 +324,8 @@ async def begin_start_extension_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,6 +336,7 @@ 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 ) @@ -333,10 +357,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) + 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 + 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( @@ -362,17 +385,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -386,5 +416,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 1238408afe97..59f6916188b3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -62,6 +61,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -74,6 +74,7 @@ async def _reimage_initial( 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'], @@ -81,7 +82,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -112,6 +117,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -126,8 +132,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +147,7 @@ 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 @@ -161,12 +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) + 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 + 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, @@ -179,18 +186,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -200,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -232,7 +246,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -244,6 +259,7 @@ 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 ) @@ -264,12 +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) + 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 + 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, @@ -282,18 +297,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -303,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,7 +358,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -348,6 +371,7 @@ 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 ) @@ -368,10 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -387,6 +410,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -396,6 +420,7 @@ async def _update_initial( 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'], @@ -403,7 +428,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -421,7 +450,7 @@ async def _update_initial( 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 @@ -458,8 +487,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +502,7 @@ 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 @@ -496,12 +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) + 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 + 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, @@ -514,18 +544,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -535,11 +572,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -566,7 +603,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -578,6 +616,7 @@ async def begin_delete( 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 ) @@ -598,10 +637,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -630,18 +668,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -655,7 +700,7 @@ async def get( 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 @@ -685,18 +730,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -710,7 +762,7 @@ async def get_instance_view( 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 @@ -731,12 +783,13 @@ 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 @@ -745,6 +798,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -757,6 +812,7 @@ def prepare_request(next_link=None): 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, @@ -771,6 +827,7 @@ def prepare_request(next_link=None): 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, @@ -791,7 +848,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]: @@ -804,9 +865,9 @@ async def get_next(next_link=None): 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, @@ -819,18 +880,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -840,11 +908,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -873,7 +941,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -885,6 +954,7 @@ async def begin_power_off( 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 ) @@ -905,12 +975,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -923,18 +992,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -944,11 +1020,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -975,7 +1051,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -987,6 +1064,7 @@ 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 ) @@ -1007,12 +1085,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1025,18 +1102,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1046,11 +1130,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1077,7 +1161,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1089,6 +1174,7 @@ 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 ) @@ -1109,12 +1195,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1127,18 +1212,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1148,11 +1240,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1180,7 +1272,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1192,6 +1285,7 @@ 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 ) @@ -1212,12 +1306,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1230,18 +1323,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1251,11 +1351,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1282,7 +1382,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1294,6 +1395,7 @@ 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 ) @@ -1314,10 +1416,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore async def _run_command_initial( self, @@ -1325,6 +1426,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"]] @@ -1333,7 +1436,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1342,6 +1445,7 @@ async def _run_command_initial( 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'], @@ -1349,7 +1453,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1365,7 +1473,7 @@ async def _run_command_initial( 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 @@ -1375,6 +1483,8 @@ async def begin_run_command( 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. @@ -1387,6 +1497,9 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_10_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 @@ -1401,8 +1514,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-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( 'polling_interval', @@ -1416,6 +1529,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1439,7 +1553,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_sets_operations.py index 4924628421ab..6d1355e6c0f3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -190,6 +197,7 @@ async def _update_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'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -211,7 +223,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -318,11 +338,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -406,17 +427,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,10 +458,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -446,6 +474,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -457,6 +486,7 @@ async def _deallocate_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'], @@ -464,7 +494,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -474,11 +508,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -493,7 +527,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -508,8 +543,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,6 +557,7 @@ 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 @@ -542,12 +579,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) + 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 + 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, @@ -560,6 +596,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -568,6 +605,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -575,7 +613,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -585,11 +627,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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -617,8 +659,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -630,6 +673,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -651,10 +695,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) + 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 + 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( @@ -680,17 +723,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -704,7 +754,7 @@ async def get_instance_view( 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 @@ -724,6 +774,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -735,6 +787,7 @@ def prepare_request(next_link=None): 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) @@ -745,6 +798,7 @@ def prepare_request(next_link=None): 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) @@ -762,7 +816,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]: @@ -775,7 +833,7 @@ async def get_next(next_link=None): 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( @@ -793,6 +851,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -803,6 +863,7 @@ def prepare_request(next_link=None): 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) @@ -812,6 +873,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -829,7 +891,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]: @@ -842,7 +908,7 @@ async def get_next(next_link=None): 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( @@ -865,6 +931,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -877,6 +945,7 @@ def prepare_request(next_link=None): 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) @@ -888,6 +957,7 @@ def prepare_request(next_link=None): 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) @@ -905,7 +975,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]: @@ -918,7 +992,7 @@ async def get_next(next_link=None): 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( @@ -940,6 +1014,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -952,6 +1028,7 @@ def prepare_request(next_link=None): 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) @@ -963,6 +1040,7 @@ def prepare_request(next_link=None): 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) @@ -980,7 +1058,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]: @@ -993,9 +1075,9 @@ async def get_next(next_link=None): 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, @@ -1008,6 +1090,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1019,6 +1102,7 @@ async def _power_off_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._power_off_initial.metadata['url'], @@ -1026,7 +1110,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1036,11 +1124,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1055,7 +1143,8 @@ async def begin_power_off( :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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1070,8 +1159,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1083,6 +1173,7 @@ async def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1104,12 +1195,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) + 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 + 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, @@ -1122,6 +1212,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1133,6 +1224,7 @@ async def _restart_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'], @@ -1140,7 +1232,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1150,11 +1246,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1167,7 +1263,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1182,8 +1279,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1195,6 +1293,7 @@ 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 @@ -1216,12 +1315,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) + 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 + 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, @@ -1234,6 +1332,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1245,6 +1344,7 @@ async def _start_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'], @@ -1252,7 +1352,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1262,11 +1366,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1279,7 +1383,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1294,8 +1399,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,6 +1413,7 @@ 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 @@ -1328,12 +1435,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) + 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 + 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, @@ -1346,6 +1452,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1357,6 +1464,7 @@ async def _redeploy_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'], @@ -1364,7 +1472,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1374,11 +1486,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1392,7 +1504,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1407,8 +1520,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1420,6 +1534,7 @@ 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 @@ -1441,12 +1556,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1459,6 +1573,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1470,6 +1585,7 @@ async def _perform_maintenance_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'], @@ -1477,7 +1593,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1487,11 +1607,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1507,7 +1627,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1522,8 +1643,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1535,6 +1657,7 @@ 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 @@ -1556,12 +1679,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1574,6 +1696,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1582,6 +1705,7 @@ async def _update_instances_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'], @@ -1589,7 +1713,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1599,11 +1727,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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1631,8 +1759,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1644,6 +1773,7 @@ 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 @@ -1665,12 +1795,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) + 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 + 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, @@ -1683,6 +1812,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -1694,6 +1824,7 @@ async def _reimage_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'], @@ -1701,7 +1832,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1711,11 +1846,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1730,7 +1865,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -1745,8 +1880,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1758,6 +1894,7 @@ 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 @@ -1779,12 +1916,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1797,6 +1933,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1808,6 +1945,7 @@ async def _reimage_all_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'], @@ -1815,7 +1953,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1825,11 +1967,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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1843,7 +1985,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1858,8 +2001,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1871,6 +2015,7 @@ 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 @@ -1892,10 +2037,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) + 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 + 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( @@ -1926,18 +2070,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -1951,5 +2102,5 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_sizes_operations.py index 06ea84609435..d187c913a14b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -64,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -85,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -102,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]: @@ -115,4 +121,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machines_operations.py index 6bd3243b8f6f..990085ac1ced 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -317,8 +337,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -330,6 +351,7 @@ 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 @@ -354,10 +376,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -372,6 +393,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -380,6 +402,7 @@ async def _update_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'], @@ -387,7 +410,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -405,7 +432,7 @@ async def _update_initial( 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 @@ -438,8 +465,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -451,6 +479,7 @@ 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 @@ -475,12 +504,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) + 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 + 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, @@ -492,17 +520,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -512,11 +547,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -540,7 +575,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -551,6 +587,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -571,10 +608,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -590,8 +626,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -604,18 +640,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -629,7 +672,7 @@ async def get( 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 @@ -656,17 +699,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -680,10 +730,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -695,17 +745,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -715,11 +772,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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -744,7 +801,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -755,6 +813,7 @@ 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 ) @@ -775,12 +834,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) + 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 + 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, @@ -792,17 +850,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -812,11 +877,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -841,7 +906,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -852,6 +918,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -872,13 +939,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -901,17 +967,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -921,7 +994,7 @@ 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 @@ -942,6 +1015,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -953,6 +1028,7 @@ def prepare_request(next_link=None): 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) @@ -963,6 +1039,7 @@ def prepare_request(next_link=None): 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) @@ -980,7 +1057,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]: @@ -993,7 +1074,7 @@ async def get_next(next_link=None): 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( @@ -1010,6 +1091,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1020,6 +1103,7 @@ def prepare_request(next_link=None): 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) @@ -1029,6 +1113,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1046,7 +1131,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]: @@ -1059,7 +1148,7 @@ async def get_next(next_link=None): 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( @@ -1082,6 +1171,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1094,6 +1185,7 @@ def prepare_request(next_link=None): 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) @@ -1105,6 +1197,7 @@ def prepare_request(next_link=None): 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) @@ -1122,7 +1215,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]: @@ -1135,9 +1232,9 @@ async def get_next(next_link=None): 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, @@ -1149,17 +1246,24 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1169,11 +1273,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1198,7 +1302,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1209,6 +1314,7 @@ async def begin_power_off( raw_result = await self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1229,12 +1335,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1246,17 +1351,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -1266,11 +1378,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1294,7 +1406,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1305,6 +1418,7 @@ 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 ) @@ -1325,12 +1439,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) + 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 + 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, @@ -1342,17 +1455,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -1362,11 +1482,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1390,7 +1510,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1401,6 +1522,7 @@ 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 ) @@ -1421,12 +1543,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) + 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 + 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, @@ -1438,17 +1559,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -1458,11 +1586,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1486,7 +1614,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1497,6 +1626,7 @@ 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 ) @@ -1517,12 +1647,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) + 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 + 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, @@ -1535,6 +1664,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1546,6 +1676,7 @@ async def _reimage_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'], @@ -1553,7 +1684,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1563,11 +1698,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1580,7 +1715,8 @@ 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.v2018_10_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1594,8 +1730,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1607,6 +1744,7 @@ 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 @@ -1628,12 +1766,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1645,17 +1782,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -1665,11 +1809,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1693,7 +1837,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1704,6 +1849,7 @@ 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 ) @@ -1724,16 +1870,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # 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"]] @@ -1742,7 +1889,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1750,6 +1897,7 @@ async def _run_command_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'], @@ -1757,7 +1905,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1773,7 +1925,7 @@ async def _run_command_initial( 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 @@ -1782,6 +1934,8 @@ async def begin_run_command( 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. @@ -1792,6 +1946,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_10_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 @@ -1806,8 +1963,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2018_10_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2018-10-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( 'polling_interval', @@ -1820,6 +1977,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1843,7 +2001,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py index f589f28c8092..86d53b4325d8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -185,31 +187,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -253,31 +257,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,6 +335,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -338,6 +344,7 @@ def create_or_update( 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'], @@ -345,7 +352,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -359,7 +370,7 @@ def create_or_update( 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 @@ -389,6 +400,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -397,6 +409,7 @@ def update( 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'], @@ -404,7 +417,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +435,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -445,17 +462,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -465,7 +489,7 @@ 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 @@ -492,17 +516,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -516,7 +547,7 @@ def get( 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 @@ -528,7 +559,7 @@ 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 @@ -537,6 +568,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -547,6 +580,7 @@ def prepare_request(next_link=None): 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'], ) @@ -557,6 +591,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -575,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]: @@ -588,7 +627,7 @@ def get_next(next_link=None): 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( @@ -607,6 +646,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -618,6 +659,7 @@ def prepare_request(next_link=None): 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) @@ -628,6 +670,7 @@ def prepare_request(next_link=None): 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) @@ -645,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]: @@ -658,7 +705,7 @@ def get_next(next_link=None): 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( @@ -681,6 +728,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_images_operations.py index 9f905f190c56..b9fe0a6e9d44 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -154,33 +155,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -291,6 +296,7 @@ def _create_or_update_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'], @@ -298,7 +304,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -316,7 +326,7 @@ def _create_or_update_initial( 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 @@ -347,8 +357,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -360,6 +371,7 @@ 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 @@ -384,10 +396,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -402,6 +413,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -410,6 +422,7 @@ def _update_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'], @@ -417,7 +430,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -435,7 +452,7 @@ def _update_initial( 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 @@ -466,8 +483,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +497,7 @@ 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 @@ -503,12 +522,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -520,17 +538,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -540,11 +565,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -568,7 +593,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,6 +605,7 @@ 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 ) @@ -599,10 +626,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -618,7 +644,7 @@ 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) @@ -631,18 +657,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -656,7 +689,7 @@ def get( 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 @@ -674,6 +707,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -685,6 +720,7 @@ def prepare_request(next_link=None): 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) @@ -695,6 +731,7 @@ def prepare_request(next_link=None): 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) @@ -712,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]: @@ -725,7 +766,7 @@ def get_next(next_link=None): 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( @@ -740,6 +781,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -750,6 +793,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -759,6 +803,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -776,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]: @@ -789,4 +838,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_log_analytics_operations.py index 0513ad01bb8e..851de1f99971 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_operations.py index a33af69ac0ef..c007aa746797 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_proximity_placement_groups_operations.py index 82e33b91906f..1ccc03da4c5f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,29 +185,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,30 +218,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -291,6 +295,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -299,6 +304,7 @@ def create_or_update( 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'], @@ -306,7 +312,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -324,7 +334,7 @@ def create_or_update( 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 @@ -354,6 +364,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -362,6 +373,7 @@ def update( 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'], @@ -369,7 +381,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -383,11 +399,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -410,17 +426,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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,7 +453,7 @@ 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 @@ -457,17 +480,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -481,7 +511,7 @@ def get( 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 @@ -498,6 +528,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -508,6 +540,7 @@ def prepare_request(next_link=None): 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) @@ -517,6 +550,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -534,7 +568,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]: @@ -547,7 +585,7 @@ def get_next(next_link=None): 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( @@ -566,6 +604,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -577,6 +617,7 @@ def prepare_request(next_link=None): 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) @@ -587,6 +628,7 @@ def prepare_request(next_link=None): 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) @@ -604,7 +646,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]: @@ -617,4 +663,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_usage_operations.py index bff99457894e..89c263c67042 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extension_images_operations.py index 52cc70d61ba9..e4e18c3562cf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extensions_operations.py index d270ce42f486..516547e753c7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,9 +127,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -137,16 +138,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -160,10 +161,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -171,23 +173,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -200,33 +202,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,6 +269,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -275,6 +279,7 @@ def _create_or_update_initial( 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'], @@ -282,7 +287,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -300,7 +309,7 @@ def _create_or_update_initial( 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 @@ -338,8 +347,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,6 +362,7 @@ 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 @@ -376,10 +387,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -395,6 +405,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -404,6 +415,7 @@ def _update_initial( 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'], @@ -411,7 +423,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -425,7 +441,7 @@ def _update_initial( 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 @@ -463,8 +479,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,6 +494,7 @@ 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 @@ -501,12 +519,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -519,18 +536,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -540,11 +564,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -571,7 +595,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -583,6 +608,7 @@ 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 ) @@ -603,10 +629,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -625,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) @@ -638,19 +663,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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) - 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]: @@ -664,7 +696,7 @@ def get( 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 @@ -681,7 +713,7 @@ 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) @@ -694,18 +726,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -719,5 +758,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_images_operations.py index 03e7c23bf74f..1a32b671b2f4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_run_commands_operations.py index 7d3b73dc7559..cb542d164fc8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -65,31 +66,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -132,6 +134,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -143,6 +147,7 @@ def prepare_request(next_link=None): 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) @@ -153,6 +158,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -170,7 +176,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]: @@ -183,7 +193,7 @@ def get_next(next_link=None): 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( @@ -209,17 +219,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -233,5 +250,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_extensions_operations.py index b8b9fe141f3d..a34dcbc7d04c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,9 +82,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -92,16 +93,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -115,10 +116,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -126,23 +128,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -153,31 +155,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -217,6 +220,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -226,6 +230,7 @@ def _create_or_update_initial( 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'], @@ -233,7 +238,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -251,7 +260,7 @@ def _create_or_update_initial( 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 @@ -290,8 +299,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -304,6 +314,7 @@ 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 @@ -328,12 +339,11 @@ 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) + 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 + begin_create_or_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: str, vm_scale_set_name: str, @@ -346,18 +356,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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,11 +384,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -398,7 +415,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,6 +428,7 @@ 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 ) @@ -430,10 +449,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -452,7 +470,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) @@ -465,19 +483,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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) - 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]: @@ -491,7 +516,7 @@ def get( 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 @@ -514,6 +539,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -526,6 +553,7 @@ def prepare_request(next_link=None): 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) @@ -537,6 +565,7 @@ def prepare_request(next_link=None): 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) @@ -554,7 +583,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]: @@ -567,4 +600,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index d9ef1526ed25..1cec9e14cbbb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,25 +33,26 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -62,25 +63,26 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -91,25 +93,26 @@ def build_start_extension_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -120,31 +123,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -170,7 +174,7 @@ 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: str, vm_scale_set_name: str, @@ -182,17 +186,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -202,11 +213,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -230,7 +241,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -241,6 +253,7 @@ 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 ) @@ -261,12 +274,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -278,17 +290,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,11 +317,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -328,7 +347,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -339,6 +359,7 @@ 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 ) @@ -359,12 +380,11 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def _start_extension_upgrade_initial( + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -376,17 +396,24 @@ def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -396,11 +423,11 @@ 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 @distributed_trace - def begin_start_extension_upgrade( + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -426,7 +453,8 @@ def begin_start_extension_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -437,6 +465,7 @@ 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 ) @@ -457,10 +486,9 @@ 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) + 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 + begin_start_extension_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -486,17 +514,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -510,5 +545,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_vms_operations.py index 92f97303e2ad..2440bfb8b14d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,11 +39,11 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -51,22 +51,22 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,9 +80,10 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -90,16 +91,16 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -111,9 +112,10 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -121,16 +123,16 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -145,12 +147,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -158,23 +160,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -188,9 +190,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -198,16 +201,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -219,10 +222,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -230,21 +234,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -256,10 +260,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-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') + _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'), @@ -267,21 +272,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -296,37 +301,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -338,9 +344,10 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -348,16 +355,16 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -369,9 +376,10 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -379,16 +387,16 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -400,9 +408,10 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -410,16 +419,16 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -431,9 +440,10 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -441,16 +451,16 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -462,9 +472,10 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -472,16 +483,16 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -496,12 +507,12 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -509,29 +520,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -553,7 +564,7 @@ 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: str, vm_scale_set_name: str, @@ -567,6 +578,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -579,6 +591,7 @@ def _reimage_initial( 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'], @@ -586,7 +599,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -596,11 +613,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -617,6 +634,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -631,8 +649,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -645,6 +664,7 @@ 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 @@ -666,12 +686,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -684,18 +703,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -705,11 +731,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -737,7 +763,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -749,6 +776,7 @@ 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 ) @@ -769,12 +797,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -787,18 +814,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -808,11 +842,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -841,7 +875,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -853,6 +888,7 @@ 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 ) @@ -873,10 +909,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -892,6 +927,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -901,6 +937,7 @@ def _update_initial( 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'], @@ -908,7 +945,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -926,7 +967,7 @@ def _update_initial( 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 @@ -963,8 +1004,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -977,6 +1019,7 @@ 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 @@ -1001,12 +1044,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1019,18 +1061,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1040,11 +1089,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1071,7 +1120,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1083,6 +1133,7 @@ def begin_delete( 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 ) @@ -1103,10 +1154,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1135,18 +1185,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1160,7 +1217,7 @@ def get( 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 @@ -1190,18 +1247,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -1215,7 +1279,7 @@ def get_instance_view( 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 @@ -1236,12 +1300,13 @@ 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 @@ -1250,6 +1315,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1262,6 +1329,7 @@ def prepare_request(next_link=None): 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, @@ -1276,6 +1344,7 @@ def prepare_request(next_link=None): 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, @@ -1296,7 +1365,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]: @@ -1309,9 +1382,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1324,18 +1397,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1345,11 +1425,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1378,7 +1458,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1390,6 +1471,7 @@ def begin_power_off( 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 ) @@ -1410,12 +1492,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1428,18 +1509,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1449,11 +1537,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1480,7 +1568,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1492,6 +1581,7 @@ 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 ) @@ -1512,12 +1602,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1530,18 +1619,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1551,11 +1647,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1582,7 +1678,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1594,6 +1691,7 @@ 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 ) @@ -1614,12 +1712,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1632,18 +1729,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1653,11 +1757,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1685,7 +1789,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1697,6 +1802,7 @@ 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 ) @@ -1717,12 +1823,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1735,18 +1840,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1756,11 +1868,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1787,7 +1899,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1799,6 +1912,7 @@ 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 ) @@ -1819,10 +1933,9 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore def _run_command_initial( self, @@ -1830,6 +1943,8 @@ 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"]] @@ -1838,7 +1953,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1847,6 +1962,7 @@ def _run_command_initial( 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'], @@ -1854,7 +1970,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1870,7 +1990,7 @@ def _run_command_initial( 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 @@ -1880,6 +2000,8 @@ def begin_run_command( 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. @@ -1892,6 +2014,9 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_10_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 @@ -1905,8 +2030,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-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( 'polling_interval', @@ -1920,6 +2045,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1943,7 +2069,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_sets_operations.py index fefe664074f3..db1ff252e869 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,31 +153,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,33 +192,33 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -232,33 +234,33 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -271,31 +273,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -305,30 +308,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -337,29 +341,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -370,31 +375,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -405,31 +411,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -443,33 +450,33 @@ def build_power_off_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -485,33 +492,33 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -527,33 +534,33 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -569,33 +576,33 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -611,33 +618,33 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -653,33 +660,33 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -695,33 +702,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -737,33 +744,33 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -778,36 +785,37 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -842,6 +850,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -850,6 +859,7 @@ def _create_or_update_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'], @@ -857,7 +867,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -875,7 +889,7 @@ def _create_or_update_initial( 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 @@ -908,8 +922,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -921,6 +936,7 @@ 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 @@ -945,10 +961,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -963,6 +978,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -971,6 +987,7 @@ def _update_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'], @@ -978,7 +995,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -992,7 +1013,7 @@ def _update_initial( 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 @@ -1025,8 +1046,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1038,6 +1060,7 @@ 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 @@ -1062,12 +1085,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1079,17 +1101,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1099,11 +1128,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1127,7 +1156,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1138,6 +1168,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -1158,10 +1189,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1187,17 +1217,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1211,10 +1248,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1227,6 +1264,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1238,6 +1276,7 @@ def _deallocate_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'], @@ -1245,7 +1284,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1255,11 +1298,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1274,7 +1317,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1289,8 +1333,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1302,6 +1347,7 @@ 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 @@ -1323,12 +1369,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1341,6 +1386,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1349,6 +1395,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1356,7 +1403,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1366,11 +1417,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1398,8 +1449,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1411,6 +1463,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1432,10 +1485,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1461,17 +1513,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -1485,7 +1544,7 @@ def get_instance_view( 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 @@ -1505,6 +1564,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1516,6 +1577,7 @@ def prepare_request(next_link=None): 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) @@ -1526,6 +1588,7 @@ def prepare_request(next_link=None): 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) @@ -1543,7 +1606,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]: @@ -1556,7 +1623,7 @@ def get_next(next_link=None): 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( @@ -1574,6 +1641,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1584,6 +1653,7 @@ def prepare_request(next_link=None): 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) @@ -1593,6 +1663,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1610,7 +1681,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]: @@ -1623,7 +1698,7 @@ def get_next(next_link=None): 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( @@ -1646,6 +1721,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1658,6 +1735,7 @@ def prepare_request(next_link=None): 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) @@ -1669,6 +1747,7 @@ def prepare_request(next_link=None): 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) @@ -1686,7 +1765,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]: @@ -1699,7 +1782,7 @@ def get_next(next_link=None): 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( @@ -1721,6 +1804,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1733,6 +1818,7 @@ def prepare_request(next_link=None): 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) @@ -1744,6 +1830,7 @@ def prepare_request(next_link=None): 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) @@ -1761,7 +1848,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]: @@ -1774,9 +1865,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1789,6 +1880,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1800,6 +1892,7 @@ def _power_off_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._power_off_initial.metadata['url'], @@ -1807,7 +1900,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1817,11 +1914,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1836,7 +1933,8 @@ def begin_power_off( :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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1851,8 +1949,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1864,6 +1963,7 @@ def begin_power_off( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1885,12 +1985,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1903,6 +2002,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1914,6 +2014,7 @@ def _restart_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'], @@ -1921,7 +2022,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1931,11 +2036,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1948,7 +2053,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1963,8 +2069,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1976,6 +2083,7 @@ 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 @@ -1997,12 +2105,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2015,6 +2122,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2026,6 +2134,7 @@ def _start_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'], @@ -2033,7 +2142,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2043,11 +2156,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2060,7 +2173,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2075,8 +2189,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2088,6 +2203,7 @@ 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 @@ -2109,12 +2225,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2127,6 +2242,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2138,6 +2254,7 @@ def _redeploy_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'], @@ -2145,7 +2262,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2155,11 +2276,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2173,7 +2294,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2188,8 +2310,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2201,6 +2324,7 @@ 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 @@ -2222,12 +2346,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2240,6 +2363,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2251,6 +2375,7 @@ def _perform_maintenance_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'], @@ -2258,7 +2383,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2268,11 +2397,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2288,7 +2417,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2303,8 +2433,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2316,6 +2447,7 @@ 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 @@ -2337,12 +2469,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2355,6 +2486,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2363,6 +2495,7 @@ def _update_instances_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'], @@ -2370,7 +2503,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2380,11 +2517,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2412,8 +2549,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2425,6 +2563,7 @@ 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 @@ -2446,12 +2585,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2464,6 +2602,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -2475,6 +2614,7 @@ def _reimage_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'], @@ -2482,7 +2622,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2492,11 +2636,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2511,7 +2655,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2018_10_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -2526,8 +2670,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2539,6 +2684,7 @@ 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 @@ -2560,12 +2706,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2578,6 +2723,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2589,6 +2735,7 @@ def _reimage_all_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'], @@ -2596,7 +2743,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2606,11 +2757,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2624,7 +2775,8 @@ 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. + :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.v2018_10_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2639,8 +2791,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2652,6 +2805,7 @@ 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 @@ -2673,10 +2827,9 @@ 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) + 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 + 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( @@ -2707,18 +2860,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -2732,5 +2892,5 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_sizes_operations.py index 9527e5096d0f..b3e278c4bd08 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,6 +99,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -109,6 +112,7 @@ def prepare_request(next_link=None): 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) @@ -119,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machines_operations.py index 0a59ab50f19e..01c79897c6d0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_10_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -200,25 +201,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -231,33 +233,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -268,31 +271,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -303,25 +307,26 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -332,25 +337,26 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -361,25 +367,26 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -389,30 +396,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -421,29 +429,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -454,31 +463,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -489,25 +499,26 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -518,25 +529,26 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -547,25 +559,26 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -576,25 +589,26 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -608,33 +622,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -647,25 +661,26 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2018-10-01" + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -679,41 +694,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2018-10-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -752,6 +767,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -763,6 +780,7 @@ def prepare_request(next_link=None): 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) @@ -773,6 +791,7 @@ def prepare_request(next_link=None): 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) @@ -790,7 +809,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]: @@ -803,7 +826,7 @@ def get_next(next_link=None): 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, @@ -818,6 +841,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -826,6 +850,7 @@ def _capture_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'], @@ -833,7 +858,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -849,7 +878,7 @@ def _capture_initial( 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 @@ -883,8 +912,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -896,6 +926,7 @@ 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 @@ -920,10 +951,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -938,6 +968,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -946,6 +977,7 @@ def _create_or_update_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'], @@ -953,7 +985,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -971,7 +1007,7 @@ def _create_or_update_initial( 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 @@ -1003,8 +1039,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1016,6 +1053,7 @@ 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 @@ -1040,10 +1078,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1058,6 +1095,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1066,6 +1104,7 @@ def _update_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'], @@ -1073,7 +1112,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1091,7 +1134,7 @@ def _update_initial( 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 @@ -1123,8 +1166,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1136,6 +1180,7 @@ 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 @@ -1160,12 +1205,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1177,17 +1221,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1197,11 +1248,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1225,7 +1276,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1236,6 +1288,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1256,10 +1309,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1275,8 +1327,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1289,18 +1341,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -1314,7 +1373,7 @@ def get( 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 @@ -1341,17 +1400,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: 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) - 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]: @@ -1365,10 +1431,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1380,17 +1446,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1400,11 +1473,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1429,7 +1502,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1440,6 +1514,7 @@ 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 ) @@ -1460,12 +1535,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1477,17 +1551,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1497,11 +1578,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1526,7 +1607,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1537,6 +1619,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1557,13 +1640,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1586,17 +1668,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -1606,7 +1695,7 @@ 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 @@ -1627,6 +1716,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1638,6 +1729,7 @@ def prepare_request(next_link=None): 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) @@ -1648,6 +1740,7 @@ def prepare_request(next_link=None): 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) @@ -1665,7 +1758,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]: @@ -1678,7 +1775,7 @@ def get_next(next_link=None): 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( @@ -1695,6 +1792,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1705,6 +1804,7 @@ def prepare_request(next_link=None): 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) @@ -1714,6 +1814,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1731,7 +1832,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]: @@ -1744,7 +1849,7 @@ def get_next(next_link=None): 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( @@ -1767,6 +1872,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2018_10_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1779,6 +1886,7 @@ def prepare_request(next_link=None): 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) @@ -1790,6 +1898,7 @@ def prepare_request(next_link=None): 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) @@ -1807,7 +1916,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]: @@ -1820,9 +1933,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -1834,17 +1947,24 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1854,11 +1974,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1883,7 +2003,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1894,6 +2015,7 @@ def begin_power_off( raw_result = self._power_off_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1914,12 +2036,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1931,17 +2052,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -1951,11 +2079,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1979,7 +2107,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1990,6 +2119,7 @@ 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 ) @@ -2010,12 +2140,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2027,17 +2156,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -2047,11 +2183,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2075,7 +2211,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2086,6 +2223,7 @@ 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 ) @@ -2106,12 +2244,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2123,17 +2260,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -2143,11 +2287,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2171,7 +2315,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2182,6 +2327,7 @@ 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 ) @@ -2202,12 +2348,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2220,6 +2365,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -2231,6 +2377,7 @@ def _reimage_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'], @@ -2238,7 +2385,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2248,11 +2399,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2265,7 +2416,8 @@ 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.v2018_10_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2279,8 +2431,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2018-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2292,6 +2445,7 @@ 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 @@ -2313,12 +2467,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2330,17 +2483,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + 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) - 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]: @@ -2350,11 +2510,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2378,7 +2538,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2389,6 +2550,7 @@ 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 ) @@ -2409,16 +2571,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore def _run_command_initial( self, resource_group_name: 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"]] @@ -2427,7 +2590,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2018-10-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2435,6 +2598,7 @@ def _run_command_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'], @@ -2442,7 +2606,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2458,7 +2626,7 @@ def _run_command_initial( 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 @@ -2467,6 +2635,8 @@ def begin_run_command( 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. @@ -2477,6 +2647,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2018_10_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 @@ -2490,8 +2663,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2018_10_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2018-10-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( 'polling_interval', @@ -2504,6 +2677,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2527,7 +2701,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py index a1aee5f5f362..27b83b1611bb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -96,8 +97,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-03-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. """ @@ -145,7 +149,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_configuration.py index 9e2d465e80c7..f346535cc73d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2019-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-03-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_metadata.json index 0f8b8d4ad5ef..9370092bee53 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_compute_management_client.py index 9950faea5530..0e70fa2f1256 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -98,8 +99,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-03-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_configuration.py index 21dd8afa3770..fa49857a5273 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/_configuration.py @@ -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 "2019-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-03-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_availability_sets_operations.py index 28d261083835..036bf2048840 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_host_groups_operations.py index 72446603651b..8b81fc3c09df 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -138,6 +143,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -146,6 +152,7 @@ async def update( 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'], @@ -153,7 +160,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -167,11 +178,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -194,17 +205,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -214,7 +232,7 @@ 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 @@ -241,17 +259,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -265,7 +290,7 @@ async def get( 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 @@ -286,6 +311,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -297,6 +324,7 @@ def prepare_request(next_link=None): 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) @@ -307,6 +335,7 @@ def prepare_request(next_link=None): 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) @@ -324,7 +353,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]: @@ -337,7 +370,7 @@ async def get_next(next_link=None): 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( @@ -354,6 +387,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +399,7 @@ def prepare_request(next_link=None): 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) @@ -373,6 +409,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -390,7 +427,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]: @@ -403,4 +444,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_hosts_operations.py index 781b0af27c8d..421a2ad9c65e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -255,8 +267,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,6 +282,7 @@ 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 @@ -293,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -311,18 +324,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -332,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -363,7 +383,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -375,6 +396,7 @@ 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 ) @@ -395,10 +417,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace_async async def get( @@ -417,8 +438,8 @@ async def get( :type host_group_name: str :param host_name: The name of the dedicated host. :type host_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -431,19 +452,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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) - 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]: @@ -457,7 +485,7 @@ async def get( 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 @@ -481,6 +509,8 @@ def list_by_host_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -493,6 +523,7 @@ def prepare_request(next_link=None): 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) @@ -504,6 +535,7 @@ def prepare_request(next_link=None): 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) @@ -521,7 +553,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]: @@ -534,4 +570,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_disks_operations.py index c77eedca0c79..9e12ebeb51e7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_galleries_operations.py index c9f4022d8608..c13472ff5eda 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -97,7 +102,7 @@ async def _create_or_update_initial( 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 @@ -130,8 +135,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ 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 @@ -167,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace_async async def get( @@ -196,17 +202,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -220,10 +233,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -235,17 +248,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -255,11 +275,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -283,7 +303,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -294,6 +315,7 @@ 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 ) @@ -314,10 +336,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -335,6 +356,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -346,6 +369,7 @@ def prepare_request(next_link=None): 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) @@ -356,6 +380,7 @@ def prepare_request(next_link=None): 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) @@ -373,7 +398,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]: @@ -386,7 +415,7 @@ async def get_next(next_link=None): 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( @@ -401,6 +430,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -411,6 +442,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -420,6 +452,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -437,7 +470,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]: @@ -450,4 +487,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_application_versions_operations.py index ef0f71f1e48c..6fd0113ecf64 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -147,8 +152,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -162,6 +168,7 @@ 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 @@ -186,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore @distributed_trace_async async def get( @@ -214,7 +220,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.v2019_03_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) @@ -227,6 +233,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -234,13 +242,18 @@ async def get( 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) - 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]: @@ -254,10 +267,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -271,6 +284,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -278,12 +293,17 @@ async def _delete_initial( 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) - 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]: @@ -293,11 +313,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -330,7 +350,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -343,6 +364,7 @@ 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 ) @@ -363,10 +385,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) + 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 + 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( @@ -393,6 +414,8 @@ def list_by_gallery_application( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -406,6 +429,7 @@ def prepare_request(next_link=None): 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) @@ -418,6 +442,7 @@ def prepare_request(next_link=None): 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) @@ -435,7 +460,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]: @@ -448,4 +477,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_applications_operations.py index 85dcd58146ee..24af4929760b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplication') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -139,8 +144,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -153,6 +159,7 @@ 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 @@ -177,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace_async async def get( @@ -211,18 +217,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, + 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(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]: @@ -236,10 +249,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -252,18 +265,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -273,11 +293,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -305,7 +325,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -317,6 +338,7 @@ 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 ) @@ -337,10 +359,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -363,6 +384,8 @@ def list_by_gallery( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -375,6 +398,7 @@ def prepare_request(next_link=None): 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) @@ -386,6 +410,7 @@ def prepare_request(next_link=None): 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) @@ -403,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]: @@ -416,4 +445,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_image_versions_operations.py index 1a9f7819484a..74d49d76f3cc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -146,8 +151,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -161,6 +167,7 @@ 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 @@ -185,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore @distributed_trace_async async def get( @@ -212,7 +218,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.v2019_03_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) @@ -225,6 +231,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -232,13 +240,18 @@ async def get( 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) - 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]: @@ -252,10 +265,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -269,6 +282,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -276,12 +291,17 @@ async def _delete_initial( 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) - 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]: @@ -291,11 +311,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -327,7 +347,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -340,6 +361,7 @@ 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 ) @@ -360,10 +382,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) + 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 + 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( @@ -390,6 +411,8 @@ def list_by_gallery_image( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -403,6 +426,7 @@ def prepare_request(next_link=None): 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) @@ -415,6 +439,7 @@ def prepare_request(next_link=None): 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) @@ -432,7 +457,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]: @@ -445,4 +474,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_images_operations.py index 468f9a2dccea..361070478ba6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,6 +157,7 @@ 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 @@ -175,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace_async async def get( @@ -208,18 +214,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, + 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(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]: @@ -233,10 +246,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -249,18 +262,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -270,11 +290,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -302,7 +322,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -314,6 +335,7 @@ 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 ) @@ -334,10 +356,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -359,6 +380,8 @@ def list_by_gallery( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -371,6 +394,7 @@ def prepare_request(next_link=None): 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) @@ -382,6 +406,7 @@ def prepare_request(next_link=None): 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) @@ -399,7 +424,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]: @@ -412,4 +441,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_images_operations.py index fe9dd81405d8..51214c010637 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_log_analytics_operations.py index 66348c57ddd4..382e8492225e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_operations.py index bca3cce67d9d..c34642961d97 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_proximity_placement_groups_operations.py index 59ac44cc65ba..56897f29790d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -239,17 +257,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -263,7 +288,7 @@ async def get( 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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) @@ -299,6 +327,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -316,7 +345,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]: @@ -329,7 +362,7 @@ async def get_next(next_link=None): 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( @@ -348,6 +381,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -359,6 +394,7 @@ def prepare_request(next_link=None): 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) @@ -369,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -386,7 +423,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]: @@ -399,4 +440,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_snapshots_operations.py index b849d438d4a6..d0b6f94b8e69 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_usage_operations.py index 1dae671ea922..df3531a0f181 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extension_images_operations.py index 1fc1dfa0ba02..ee4d2687430f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extensions_operations.py index 9c30a831ad76..9240e1308e64 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_images_operations.py index 97507f0f297e..94ec04349d45 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_run_commands_operations.py index 59bbf6016a0d..02b657599992 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,7 +121,7 @@ async def get_next(next_link=None): 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( @@ -140,17 +147,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -164,5 +178,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 539973e2ab74..7bd0faa1a11f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,12 +180,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -191,18 +197,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -212,11 +225,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -243,7 +256,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -255,6 +269,7 @@ 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 ) @@ -275,10 +290,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -297,7 +311,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) @@ -310,19 +324,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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) - 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]: @@ -336,7 +357,7 @@ async def get( 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 @@ -359,6 +380,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -371,6 +394,7 @@ def prepare_request(next_link=None): 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) @@ -382,6 +406,7 @@ def prepare_request(next_link=None): 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) @@ -399,7 +424,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]: @@ -412,4 +441,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index bd209d49f850..a8a0dbe9cbe0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,12 +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) + 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 + 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, @@ -252,17 +267,24 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -272,11 +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 @distributed_trace_async - async def begin_start_extension_upgrade( + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -302,7 +324,8 @@ async def begin_start_extension_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,6 +336,7 @@ 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 ) @@ -333,10 +357,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) + 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 + 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( @@ -362,17 +385,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -386,5 +416,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 4dc26997ad0f..beba07c861ae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -62,6 +61,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -74,6 +74,7 @@ async def _reimage_initial( 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'], @@ -81,7 +82,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -112,6 +117,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -126,8 +132,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +147,7 @@ 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 @@ -161,12 +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) + 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 + 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, @@ -179,18 +186,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -200,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -232,7 +246,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -244,6 +259,7 @@ 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 ) @@ -264,12 +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) + 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 + 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, @@ -282,18 +297,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -303,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,7 +358,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -348,6 +371,7 @@ 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 ) @@ -368,10 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -387,6 +410,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -396,6 +420,7 @@ async def _update_initial( 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'], @@ -403,7 +428,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -421,7 +450,7 @@ async def _update_initial( 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 @@ -458,8 +487,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +502,7 @@ 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 @@ -496,12 +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) + 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 + 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, @@ -514,18 +544,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -535,11 +572,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -566,7 +603,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -578,6 +616,7 @@ async def begin_delete( 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 ) @@ -598,10 +637,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -620,8 +658,8 @@ async def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. :type instance_id: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -634,19 +672,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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) - 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]: @@ -660,7 +705,7 @@ async def get( 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 @@ -690,18 +735,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -715,7 +767,7 @@ async def get_instance_view( 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 @@ -736,12 +788,13 @@ 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 @@ -750,6 +803,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -762,6 +817,7 @@ def prepare_request(next_link=None): 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, @@ -776,6 +832,7 @@ def prepare_request(next_link=None): 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, @@ -796,7 +853,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]: @@ -809,9 +870,9 @@ async def get_next(next_link=None): 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, @@ -825,19 +886,26 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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) - 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]: @@ -847,11 +915,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -871,7 +939,7 @@ 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. @@ -885,7 +953,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -898,6 +967,7 @@ 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 ) @@ -918,12 +988,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -936,18 +1005,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -957,11 +1033,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -988,7 +1064,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1000,6 +1077,7 @@ 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 ) @@ -1020,12 +1098,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1038,18 +1115,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1059,11 +1143,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1090,7 +1174,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1102,6 +1187,7 @@ 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 ) @@ -1122,12 +1208,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1140,18 +1225,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1161,11 +1253,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1193,7 +1285,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1205,6 +1298,7 @@ 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 ) @@ -1225,12 +1319,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1243,18 +1336,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1264,11 +1364,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1295,7 +1395,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,6 +1408,7 @@ 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 ) @@ -1327,10 +1429,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore async def _run_command_initial( self, @@ -1338,6 +1439,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"]] @@ -1346,7 +1449,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1355,6 +1458,7 @@ async def _run_command_initial( 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'], @@ -1362,7 +1466,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1378,7 +1486,7 @@ async def _run_command_initial( 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 @@ -1388,6 +1496,8 @@ async def begin_run_command( 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. @@ -1400,6 +1510,9 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_03_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 @@ -1414,8 +1527,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-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( 'polling_interval', @@ -1429,6 +1542,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1452,7 +1566,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_sets_operations.py index f9896b36220e..d0194d8f83bf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -190,6 +197,7 @@ async def _update_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'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -211,7 +223,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -318,11 +338,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -406,17 +427,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,10 +458,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -446,6 +474,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -457,6 +486,7 @@ async def _deallocate_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'], @@ -464,7 +494,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -474,11 +508,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -493,7 +527,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -508,8 +543,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,6 +557,7 @@ 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 @@ -542,12 +579,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) + 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 + 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, @@ -560,6 +596,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -568,6 +605,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -575,7 +613,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -585,11 +627,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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -617,8 +659,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -630,6 +673,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -651,10 +695,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) + 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 + 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( @@ -680,17 +723,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -704,7 +754,7 @@ async def get_instance_view( 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 @@ -724,6 +774,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -735,6 +787,7 @@ def prepare_request(next_link=None): 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) @@ -745,6 +798,7 @@ def prepare_request(next_link=None): 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) @@ -762,7 +816,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]: @@ -775,7 +833,7 @@ async def get_next(next_link=None): 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( @@ -793,6 +851,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -803,6 +863,7 @@ def prepare_request(next_link=None): 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) @@ -812,6 +873,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -829,7 +891,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]: @@ -842,7 +908,7 @@ async def get_next(next_link=None): 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( @@ -865,6 +931,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -877,6 +945,7 @@ def prepare_request(next_link=None): 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) @@ -888,6 +957,7 @@ def prepare_request(next_link=None): 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) @@ -905,7 +975,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]: @@ -918,7 +992,7 @@ async def get_next(next_link=None): 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( @@ -940,6 +1014,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -952,6 +1028,7 @@ def prepare_request(next_link=None): 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) @@ -963,6 +1040,7 @@ def prepare_request(next_link=None): 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) @@ -980,7 +1058,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]: @@ -993,9 +1075,9 @@ async def get_next(next_link=None): 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, @@ -1009,6 +1091,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1020,6 +1103,7 @@ async def _power_off_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, @@ -1028,7 +1112,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1038,11 +1126,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1060,9 +1148,10 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1077,8 +1166,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1091,6 +1181,7 @@ 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 @@ -1112,12 +1203,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) + 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 + 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, @@ -1130,6 +1220,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1141,6 +1232,7 @@ async def _restart_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'], @@ -1148,7 +1240,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1158,11 +1254,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1175,7 +1271,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1190,8 +1287,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1203,6 +1301,7 @@ 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 @@ -1224,12 +1323,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) + 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 + 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, @@ -1242,6 +1340,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1253,6 +1352,7 @@ async def _start_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'], @@ -1260,7 +1360,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +1374,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1287,7 +1391,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1302,8 +1407,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1315,6 +1421,7 @@ 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 @@ -1336,12 +1443,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) + 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 + 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, @@ -1354,6 +1460,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1365,6 +1472,7 @@ async def _redeploy_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'], @@ -1372,7 +1480,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1382,11 +1494,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1400,7 +1512,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1415,8 +1528,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1428,6 +1542,7 @@ 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 @@ -1449,12 +1564,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1467,6 +1581,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1478,6 +1593,7 @@ async def _perform_maintenance_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'], @@ -1485,7 +1601,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1495,11 +1615,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1515,7 +1635,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1530,8 +1651,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1543,6 +1665,7 @@ 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 @@ -1564,12 +1687,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1582,6 +1704,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1590,6 +1713,7 @@ async def _update_instances_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'], @@ -1597,7 +1721,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1607,11 +1735,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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1639,8 +1767,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1652,6 +1781,7 @@ 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 @@ -1673,12 +1803,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) + 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 + 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, @@ -1691,6 +1820,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -1702,6 +1832,7 @@ async def _reimage_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'], @@ -1709,7 +1840,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1719,11 +1854,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1738,7 +1873,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -1753,8 +1888,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1766,6 +1902,7 @@ 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 @@ -1787,12 +1924,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1805,6 +1941,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1816,6 +1953,7 @@ async def _reimage_all_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'], @@ -1823,7 +1961,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1833,11 +1975,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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1851,7 +1993,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1866,8 +2009,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1879,6 +2023,7 @@ 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 @@ -1900,10 +2045,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) + 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 + 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( @@ -1934,18 +2078,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -1959,11 +2110,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + async def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1990,6 +2141,7 @@ async def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -1998,6 +2150,7 @@ async def convert_to_single_placement_group( 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'], @@ -2005,7 +2158,11 @@ async def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2015,5 +2172,5 @@ 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_sizes_operations.py index 2dbb7c309f7d..08ffd7de1777 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -64,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -85,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -102,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]: @@ -115,4 +121,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machines_operations.py index 4b8e141f4780..e01a65afd32c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -317,8 +337,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -330,6 +351,7 @@ 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 @@ -354,10 +376,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -372,6 +393,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -380,6 +402,7 @@ async def _update_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'], @@ -387,7 +410,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -405,7 +432,7 @@ async def _update_initial( 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 @@ -438,8 +465,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -451,6 +479,7 @@ 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 @@ -475,12 +504,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) + 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 + 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, @@ -492,17 +520,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -512,11 +547,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -540,7 +575,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -551,6 +587,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -571,10 +608,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -590,8 +626,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -604,18 +640,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -629,7 +672,7 @@ async def get( 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 @@ -656,17 +699,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -680,10 +730,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -695,17 +745,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -715,11 +772,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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -744,7 +801,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -755,6 +813,7 @@ 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 ) @@ -775,12 +834,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) + 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 + 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, @@ -792,17 +850,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -812,11 +877,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -841,7 +906,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -852,6 +918,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -872,13 +939,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -901,17 +967,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -921,7 +994,7 @@ 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 @@ -942,6 +1015,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -953,6 +1028,7 @@ def prepare_request(next_link=None): 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) @@ -963,6 +1039,7 @@ def prepare_request(next_link=None): 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) @@ -980,7 +1057,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]: @@ -993,7 +1074,7 @@ async def get_next(next_link=None): 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( @@ -1010,6 +1091,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1020,6 +1103,7 @@ def prepare_request(next_link=None): 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) @@ -1029,6 +1113,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1046,7 +1131,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]: @@ -1059,7 +1148,7 @@ async def get_next(next_link=None): 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( @@ -1082,6 +1171,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1094,6 +1185,7 @@ def prepare_request(next_link=None): 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) @@ -1105,6 +1197,7 @@ def prepare_request(next_link=None): 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) @@ -1122,7 +1215,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]: @@ -1135,9 +1232,9 @@ async def get_next(next_link=None): 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, @@ -1150,18 +1247,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -1171,11 +1275,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1191,7 +1295,7 @@ 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. @@ -1205,7 +1309,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1217,6 +1322,7 @@ 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 ) @@ -1237,12 +1343,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1254,17 +1359,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -1274,11 +1386,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1302,7 +1414,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1313,6 +1426,7 @@ 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 ) @@ -1333,12 +1447,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) + 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 + 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, @@ -1350,17 +1463,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -1370,11 +1490,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1398,7 +1518,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1409,6 +1530,7 @@ 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 ) @@ -1429,12 +1551,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) + 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 + 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, @@ -1446,17 +1567,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -1466,11 +1594,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1494,7 +1622,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1505,6 +1634,7 @@ 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 ) @@ -1525,12 +1655,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) + 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 + 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, @@ -1543,6 +1672,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1554,6 +1684,7 @@ async def _reimage_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'], @@ -1561,7 +1692,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1571,11 +1706,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1588,7 +1723,8 @@ 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.v2019_03_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1602,8 +1738,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1615,6 +1752,7 @@ 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 @@ -1636,12 +1774,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1653,17 +1790,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -1673,11 +1817,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1701,7 +1845,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1712,6 +1857,7 @@ 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 ) @@ -1732,16 +1878,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # 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"]] @@ -1750,7 +1897,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1758,6 +1905,7 @@ async def _run_command_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'], @@ -1765,7 +1913,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1781,7 +1933,7 @@ async def _run_command_initial( 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 @@ -1790,6 +1942,8 @@ async def begin_run_command( 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. @@ -1800,6 +1954,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_03_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 @@ -1814,8 +1971,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-03-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( 'polling_interval', @@ -1828,6 +1985,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1851,7 +2009,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_availability_sets_operations.py index 3d1381d95fc0..bf31d019f2b1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -185,31 +187,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -253,31 +257,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,6 +335,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -338,6 +344,7 @@ def create_or_update( 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'], @@ -345,7 +352,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -359,7 +370,7 @@ def create_or_update( 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 @@ -389,6 +400,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -397,6 +409,7 @@ def update( 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'], @@ -404,7 +417,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +435,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -445,17 +462,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -465,7 +489,7 @@ 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 @@ -492,17 +516,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -516,7 +547,7 @@ def get( 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 @@ -528,7 +559,7 @@ 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 @@ -537,6 +568,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -547,6 +580,7 @@ def prepare_request(next_link=None): 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'], ) @@ -557,6 +591,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -575,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]: @@ -588,7 +627,7 @@ def get_next(next_link=None): 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( @@ -607,6 +646,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -618,6 +659,7 @@ def prepare_request(next_link=None): 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) @@ -628,6 +670,7 @@ def prepare_request(next_link=None): 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) @@ -645,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]: @@ -658,7 +705,7 @@ def get_next(next_link=None): 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( @@ -681,6 +728,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_host_groups_operations.py index bfe519782e41..d4448f57a103 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -184,30 +186,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -216,29 +219,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -293,6 +297,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -301,6 +306,7 @@ def create_or_update( 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'], @@ -308,7 +314,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -326,7 +336,7 @@ def create_or_update( 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 @@ -356,6 +366,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -364,6 +375,7 @@ def update( 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'], @@ -371,7 +383,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,11 +401,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -412,17 +428,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -432,7 +455,7 @@ 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 @@ -459,17 +482,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -483,7 +513,7 @@ def get( 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 @@ -504,6 +534,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -515,6 +547,7 @@ def prepare_request(next_link=None): 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) @@ -525,6 +558,7 @@ def prepare_request(next_link=None): 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) @@ -542,7 +576,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]: @@ -555,7 +593,7 @@ def get_next(next_link=None): 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( @@ -572,6 +610,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -582,6 +622,7 @@ def prepare_request(next_link=None): 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) @@ -591,6 +632,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -608,7 +650,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]: @@ -621,4 +667,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_hosts_operations.py index 700bed5156ae..6f0fd1ae8331 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_by_host_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -332,8 +341,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -346,6 +356,7 @@ 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 @@ -370,10 +381,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore def _update_initial( self, @@ -389,6 +399,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -398,6 +409,7 @@ def _update_initial( 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'], @@ -405,7 +417,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,7 +435,7 @@ def _update_initial( 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 @@ -454,8 +470,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,6 +485,7 @@ 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 @@ -492,12 +510,11 @@ 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) + 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 + 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: str, host_group_name: str, @@ -510,18 +527,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -531,11 +555,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -562,7 +586,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -574,6 +599,7 @@ 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 ) @@ -594,10 +620,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace def get( @@ -616,8 +641,8 @@ def get( :type host_group_name: str :param host_name: The name of the dedicated host. :type host_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -630,19 +655,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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) - 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]: @@ -656,7 +688,7 @@ def get( 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 @@ -680,6 +712,8 @@ def list_by_host_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -692,6 +726,7 @@ def prepare_request(next_link=None): 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) @@ -703,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -720,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]: @@ -733,4 +773,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py index 83c71864b63c..00bb23bdad54 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_galleries_operations.py index e96544444544..5f3dc04ae870 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -79,31 +79,32 @@ def build_get_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -114,31 +115,32 @@ def build_delete_request_initial( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -148,30 +150,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -180,29 +183,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -241,6 +245,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -249,6 +254,7 @@ def _create_or_update_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'], @@ -256,7 +262,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -277,7 +287,7 @@ def _create_or_update_initial( 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 @@ -309,8 +319,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -322,6 +333,7 @@ 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 @@ -346,10 +358,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def get( @@ -375,17 +386,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -399,10 +417,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -414,17 +432,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -434,11 +459,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -462,7 +487,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -473,6 +499,7 @@ 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 ) @@ -493,10 +520,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -513,6 +539,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -524,6 +552,7 @@ def prepare_request(next_link=None): 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) @@ -534,6 +563,7 @@ def prepare_request(next_link=None): 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) @@ -551,7 +581,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]: @@ -564,7 +598,7 @@ def get_next(next_link=None): 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( @@ -578,6 +612,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -588,6 +624,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -597,6 +634,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -614,7 +652,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]: @@ -627,4 +669,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_application_versions_operations.py index 98397a52ca22..b605e0a07de0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -87,10 +87,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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}') + _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'), @@ -99,23 +100,23 @@ def build_get_request( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -128,10 +129,11 @@ def build_delete_request_initial( gallery_application_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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}') + _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'), @@ -140,21 +142,21 @@ def build_delete_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,10 +168,11 @@ def build_list_by_gallery_application_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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') + _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'), @@ -177,21 +180,21 @@ def build_list_by_gallery_application_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -232,6 +235,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') @@ -242,6 +246,7 @@ def _create_or_update_initial( 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'], @@ -249,7 +254,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -270,7 +279,7 @@ def _create_or_update_initial( 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 @@ -316,8 +325,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,6 +341,7 @@ 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 @@ -355,10 +366,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore @distributed_trace def get( @@ -383,7 +393,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.v2019_03_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) @@ -396,6 +406,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -403,13 +415,18 @@ def get( 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) - 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]: @@ -423,10 +440,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -440,6 +457,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -447,12 +466,17 @@ def _delete_initial( 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) - 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]: @@ -462,11 +486,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -499,7 +523,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -512,6 +537,7 @@ 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 ) @@ -532,10 +558,9 @@ 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) + 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 + 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( @@ -562,6 +587,8 @@ def list_by_gallery_application( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -575,6 +602,7 @@ def prepare_request(next_link=None): 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) @@ -587,6 +615,7 @@ def prepare_request(next_link=None): 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) @@ -604,7 +633,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]: @@ -617,4 +650,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_applications_operations.py index 38c1d16e366d..d4b5557403f5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,10 +82,11 @@ def build_get_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -93,21 +94,21 @@ def build_get_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -119,10 +120,11 @@ def build_delete_request_initial( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -130,21 +132,21 @@ def build_delete_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,31 +157,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,6 +222,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplication') @@ -228,6 +232,7 @@ def _create_or_update_initial( 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'], @@ -235,7 +240,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -256,7 +265,7 @@ def _create_or_update_initial( 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 @@ -296,8 +305,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -310,6 +320,7 @@ 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 @@ -334,10 +345,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def get( @@ -368,18 +378,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, + 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(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]: @@ -393,10 +410,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -409,18 +426,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -430,11 +454,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -462,7 +486,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -474,6 +499,7 @@ 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 ) @@ -494,10 +520,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -520,6 +545,8 @@ def list_by_gallery( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -532,6 +559,7 @@ def prepare_request(next_link=None): 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) @@ -543,6 +571,7 @@ def prepare_request(next_link=None): 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) @@ -560,7 +589,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,4 +606,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_image_versions_operations.py index f49f1a150179..39af3165db03 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -87,10 +87,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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}') + _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'), @@ -99,23 +100,23 @@ def build_get_request( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -128,10 +129,11 @@ def build_delete_request_initial( gallery_image_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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}') + _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'), @@ -140,21 +142,21 @@ def build_delete_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,10 +168,11 @@ def build_list_by_gallery_image_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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') + _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'), @@ -177,21 +180,21 @@ def build_list_by_gallery_image_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -232,6 +235,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -242,6 +246,7 @@ def _create_or_update_initial( 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'], @@ -249,7 +254,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -270,7 +279,7 @@ def _create_or_update_initial( 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 @@ -315,8 +324,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -330,6 +340,7 @@ 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 @@ -354,10 +365,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore @distributed_trace def get( @@ -381,7 +391,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.v2019_03_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) @@ -394,6 +404,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -401,13 +413,18 @@ def get( 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) - 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]: @@ -421,10 +438,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -438,6 +455,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -445,12 +464,17 @@ def _delete_initial( 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) - 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]: @@ -460,11 +484,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -496,7 +520,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -509,6 +534,7 @@ 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 ) @@ -529,10 +555,9 @@ 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) + 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 + 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( @@ -559,6 +584,8 @@ def list_by_gallery_image( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -572,6 +599,7 @@ def prepare_request(next_link=None): 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) @@ -584,6 +612,7 @@ def prepare_request(next_link=None): 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) @@ -601,7 +630,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]: @@ -614,4 +647,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_images_operations.py index 20f03ebb0502..b12c6efcaa80 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,10 +82,11 @@ def build_get_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -93,21 +94,21 @@ def build_get_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -119,10 +120,11 @@ def build_delete_request_initial( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -130,21 +132,21 @@ def build_delete_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,31 +157,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,6 +222,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -228,6 +232,7 @@ def _create_or_update_initial( 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'], @@ -235,7 +240,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -256,7 +265,7 @@ def _create_or_update_initial( 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 @@ -294,8 +303,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -308,6 +318,7 @@ 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 @@ -332,10 +343,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def get( @@ -365,18 +375,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, + 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(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,10 +407,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -406,18 +423,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -427,11 +451,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -459,7 +483,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -471,6 +496,7 @@ 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 ) @@ -491,10 +517,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -515,6 +540,8 @@ def list_by_gallery( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -527,6 +554,7 @@ def prepare_request(next_link=None): 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) @@ -538,6 +566,7 @@ def prepare_request(next_link=None): 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) @@ -555,7 +584,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]: @@ -568,4 +601,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_images_operations.py index 235decb4c94d..93e72aee74da 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -154,33 +155,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -291,6 +296,7 @@ def _create_or_update_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'], @@ -298,7 +304,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -316,7 +326,7 @@ def _create_or_update_initial( 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 @@ -347,8 +357,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -360,6 +371,7 @@ 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 @@ -384,10 +396,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -402,6 +413,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -410,6 +422,7 @@ def _update_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'], @@ -417,7 +430,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -435,7 +452,7 @@ def _update_initial( 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 @@ -466,8 +483,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +497,7 @@ 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 @@ -503,12 +522,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -520,17 +538,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -540,11 +565,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -568,7 +593,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,6 +605,7 @@ 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 ) @@ -599,10 +626,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -618,7 +644,7 @@ 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) @@ -631,18 +657,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -656,7 +689,7 @@ def get( 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 @@ -674,6 +707,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -685,6 +720,7 @@ def prepare_request(next_link=None): 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) @@ -695,6 +731,7 @@ def prepare_request(next_link=None): 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) @@ -712,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]: @@ -725,7 +766,7 @@ def get_next(next_link=None): 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( @@ -740,6 +781,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -750,6 +793,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -759,6 +803,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -776,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]: @@ -789,4 +838,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_log_analytics_operations.py index 5f7b17136791..10c813c3c07d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_operations.py index 40b5be824ae0..e2665e85a29b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_proximity_placement_groups_operations.py index ac7a2dff055b..71cca9b56409 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,29 +185,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,30 +218,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -291,6 +295,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -299,6 +304,7 @@ def create_or_update( 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'], @@ -306,7 +312,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -324,7 +334,7 @@ def create_or_update( 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 @@ -354,6 +364,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -362,6 +373,7 @@ def update( 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'], @@ -369,7 +381,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -383,11 +399,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -410,17 +426,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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,7 +453,7 @@ 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 @@ -457,17 +480,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -481,7 +511,7 @@ def get( 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 @@ -498,6 +528,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -508,6 +540,7 @@ def prepare_request(next_link=None): 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) @@ -517,6 +550,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -534,7 +568,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]: @@ -547,7 +585,7 @@ def get_next(next_link=None): 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( @@ -566,6 +604,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -577,6 +617,7 @@ def prepare_request(next_link=None): 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) @@ -587,6 +628,7 @@ def prepare_request(next_link=None): 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) @@ -604,7 +646,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]: @@ -617,4 +663,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py index e40c02c62785..b1f483b4a14b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_usage_operations.py index bdab49c27c27..a85933eba15f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extension_images_operations.py index 5078a5c3aaa5..d1cc7019a024 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extensions_operations.py index 284dad163cfb..22ba8ebcf6da 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,9 +127,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -137,16 +138,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -160,10 +161,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -171,23 +173,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -200,33 +202,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,6 +269,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -275,6 +279,7 @@ def _create_or_update_initial( 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'], @@ -282,7 +287,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -300,7 +309,7 @@ def _create_or_update_initial( 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 @@ -338,8 +347,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,6 +362,7 @@ 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 @@ -376,10 +387,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -395,6 +405,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -404,6 +415,7 @@ def _update_initial( 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'], @@ -411,7 +423,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -425,7 +441,7 @@ def _update_initial( 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 @@ -463,8 +479,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,6 +494,7 @@ 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 @@ -501,12 +519,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -519,18 +536,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -540,11 +564,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -571,7 +595,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -583,6 +608,7 @@ 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 ) @@ -603,10 +629,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -625,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) @@ -638,19 +663,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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) - 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]: @@ -664,7 +696,7 @@ def get( 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 @@ -681,7 +713,7 @@ 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) @@ -694,18 +726,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -719,5 +758,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_images_operations.py index 3f0e8ef8d44a..2ab52b5cd113 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_run_commands_operations.py index 81c77a1052ef..041f25fd2610 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -65,31 +66,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -132,6 +134,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -143,6 +147,7 @@ def prepare_request(next_link=None): 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) @@ -153,6 +158,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -170,7 +176,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]: @@ -183,7 +193,7 @@ def get_next(next_link=None): 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( @@ -209,17 +219,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -233,5 +250,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_extensions_operations.py index dddccc1d8caf..7e18ecbc389e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,9 +82,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -92,16 +93,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -115,10 +116,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -126,23 +128,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -153,31 +155,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -217,6 +220,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -226,6 +230,7 @@ def _create_or_update_initial( 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'], @@ -233,7 +238,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -251,7 +260,7 @@ def _create_or_update_initial( 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 @@ -290,8 +299,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -304,6 +314,7 @@ 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 @@ -328,12 +339,11 @@ 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) + 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 + begin_create_or_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: str, vm_scale_set_name: str, @@ -346,18 +356,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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,11 +384,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -398,7 +415,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -410,6 +428,7 @@ 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 ) @@ -430,10 +449,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -452,7 +470,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) @@ -465,19 +483,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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) - 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]: @@ -491,7 +516,7 @@ def get( 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 @@ -514,6 +539,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -526,6 +553,7 @@ def prepare_request(next_link=None): 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) @@ -537,6 +565,7 @@ def prepare_request(next_link=None): 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) @@ -554,7 +583,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]: @@ -567,4 +600,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 55f461915766..70b907807209 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,25 +33,26 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -62,25 +63,26 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -91,25 +93,26 @@ def build_start_extension_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -120,31 +123,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -170,7 +174,7 @@ 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: str, vm_scale_set_name: str, @@ -182,17 +186,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -202,11 +213,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -230,7 +241,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -241,6 +253,7 @@ 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 ) @@ -261,12 +274,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -278,17 +290,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,11 +317,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -328,7 +347,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -339,6 +359,7 @@ 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 ) @@ -359,12 +380,11 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def _start_extension_upgrade_initial( + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -376,17 +396,24 @@ def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -396,11 +423,11 @@ 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 @distributed_trace - def begin_start_extension_upgrade( + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -426,7 +453,8 @@ def begin_start_extension_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -437,6 +465,7 @@ 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 ) @@ -457,10 +486,9 @@ 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) + 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 + begin_start_extension_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -486,17 +514,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -510,5 +545,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_vms_operations.py index 4cef46a08a06..101e545a6361 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,11 +39,11 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -51,22 +51,22 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,9 +80,10 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -90,16 +91,16 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -111,9 +112,10 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -121,16 +123,16 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -145,12 +147,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -158,23 +160,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -188,9 +190,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -198,16 +201,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -221,10 +224,11 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -232,23 +236,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -260,10 +264,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-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') + _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'), @@ -271,21 +276,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -300,37 +305,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -344,9 +350,10 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -354,18 +361,18 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -377,9 +384,10 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -387,16 +395,16 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -408,9 +416,10 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -418,16 +427,16 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -439,9 +448,10 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -449,16 +459,16 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -470,9 +480,10 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -480,16 +491,16 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -504,12 +515,12 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -517,29 +528,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -561,7 +572,7 @@ 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: str, vm_scale_set_name: str, @@ -575,6 +586,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -587,6 +599,7 @@ def _reimage_initial( 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'], @@ -594,7 +607,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -604,11 +621,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -625,6 +642,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -639,8 +657,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -653,6 +672,7 @@ 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 @@ -674,12 +694,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -692,18 +711,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -713,11 +739,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -745,7 +771,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -757,6 +784,7 @@ 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 ) @@ -777,12 +805,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -795,18 +822,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -816,11 +850,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -849,7 +883,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -861,6 +896,7 @@ 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 ) @@ -881,10 +917,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -900,6 +935,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -909,6 +945,7 @@ def _update_initial( 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'], @@ -916,7 +953,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -934,7 +975,7 @@ def _update_initial( 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 @@ -971,8 +1012,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -985,6 +1027,7 @@ 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 @@ -1009,12 +1052,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1027,18 +1069,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1048,11 +1097,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1079,7 +1128,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1091,6 +1141,7 @@ def begin_delete( 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 ) @@ -1111,10 +1162,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1133,8 +1183,8 @@ def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. :type instance_id: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -1147,19 +1197,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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) - 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]: @@ -1173,7 +1230,7 @@ def get( 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 @@ -1203,18 +1260,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -1228,7 +1292,7 @@ def get_instance_view( 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 @@ -1249,12 +1313,13 @@ 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 @@ -1263,6 +1328,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1275,6 +1342,7 @@ def prepare_request(next_link=None): 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, @@ -1289,6 +1357,7 @@ def prepare_request(next_link=None): 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, @@ -1309,7 +1378,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]: @@ -1322,9 +1395,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1338,19 +1411,26 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-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) - 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]: @@ -1360,11 +1440,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1384,7 +1464,7 @@ 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. @@ -1398,7 +1478,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1411,6 +1492,7 @@ 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 ) @@ -1431,12 +1513,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1449,18 +1530,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1470,11 +1558,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1501,7 +1589,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1513,6 +1602,7 @@ 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 ) @@ -1533,12 +1623,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1551,18 +1640,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1572,11 +1668,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1603,7 +1699,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1615,6 +1712,7 @@ 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 ) @@ -1635,12 +1733,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1653,18 +1750,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1674,11 +1778,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1706,7 +1810,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1718,6 +1823,7 @@ 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 ) @@ -1738,12 +1844,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1756,18 +1861,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1777,11 +1889,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1808,7 +1920,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1820,6 +1933,7 @@ 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 ) @@ -1840,10 +1954,9 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore def _run_command_initial( self, @@ -1851,6 +1964,8 @@ 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"]] @@ -1859,7 +1974,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1868,6 +1983,7 @@ def _run_command_initial( 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'], @@ -1875,7 +1991,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1891,7 +2011,7 @@ def _run_command_initial( 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 @@ -1901,6 +2021,8 @@ def begin_run_command( 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. @@ -1913,6 +2035,9 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_03_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 @@ -1926,8 +2051,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-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( 'polling_interval', @@ -1941,6 +2066,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1964,7 +2090,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_sets_operations.py index e923e6f1f4fd..31fd97256f75 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,31 +153,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,33 +192,33 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -232,33 +234,33 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -271,31 +273,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -305,30 +308,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -337,29 +341,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -370,31 +375,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -405,31 +411,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -444,35 +451,35 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -488,33 +495,33 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -530,33 +537,33 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -572,33 +579,33 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -614,33 +621,33 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -656,33 +663,33 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -698,33 +705,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -740,33 +747,33 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -781,32 +788,33 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -820,39 +828,39 @@ def build_convert_to_single_placement_group_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -887,6 +895,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -895,6 +904,7 @@ def _create_or_update_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'], @@ -902,7 +912,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -920,7 +934,7 @@ def _create_or_update_initial( 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 @@ -953,8 +967,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -966,6 +981,7 @@ 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 @@ -990,10 +1006,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -1008,6 +1023,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -1016,6 +1032,7 @@ def _update_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'], @@ -1023,7 +1040,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1037,7 +1058,7 @@ def _update_initial( 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 @@ -1070,8 +1091,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1083,6 +1105,7 @@ 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 @@ -1107,12 +1130,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1124,17 +1146,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1144,11 +1173,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1172,7 +1201,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1183,6 +1213,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -1203,10 +1234,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1232,17 +1262,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1256,10 +1293,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1272,6 +1309,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1283,6 +1321,7 @@ def _deallocate_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'], @@ -1290,7 +1329,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1300,11 +1343,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1319,7 +1362,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1334,8 +1378,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1347,6 +1392,7 @@ 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 @@ -1368,12 +1414,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1386,6 +1431,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1394,6 +1440,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1401,7 +1448,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1411,11 +1462,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1443,8 +1494,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1456,6 +1508,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1477,10 +1530,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1506,17 +1558,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -1530,7 +1589,7 @@ def get_instance_view( 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 @@ -1550,6 +1609,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1561,6 +1622,7 @@ def prepare_request(next_link=None): 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) @@ -1571,6 +1633,7 @@ def prepare_request(next_link=None): 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) @@ -1588,7 +1651,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]: @@ -1601,7 +1668,7 @@ def get_next(next_link=None): 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( @@ -1619,6 +1686,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1629,6 +1698,7 @@ def prepare_request(next_link=None): 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) @@ -1638,6 +1708,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1655,7 +1726,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]: @@ -1668,7 +1743,7 @@ def get_next(next_link=None): 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( @@ -1691,6 +1766,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1703,6 +1780,7 @@ def prepare_request(next_link=None): 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) @@ -1714,6 +1792,7 @@ def prepare_request(next_link=None): 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) @@ -1731,7 +1810,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]: @@ -1744,7 +1827,7 @@ def get_next(next_link=None): 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( @@ -1766,6 +1849,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1778,6 +1863,7 @@ def prepare_request(next_link=None): 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) @@ -1789,6 +1875,7 @@ def prepare_request(next_link=None): 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) @@ -1806,7 +1893,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]: @@ -1819,9 +1910,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1835,6 +1926,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1846,6 +1938,7 @@ def _power_off_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, @@ -1854,7 +1947,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1864,11 +1961,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1886,9 +1983,10 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1903,8 +2001,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1917,6 +2016,7 @@ 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 @@ -1938,12 +2038,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1956,6 +2055,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1967,6 +2067,7 @@ def _restart_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'], @@ -1974,7 +2075,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1984,11 +2089,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2001,7 +2106,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2016,8 +2122,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2029,6 +2136,7 @@ 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 @@ -2050,12 +2158,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2068,6 +2175,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2079,6 +2187,7 @@ def _start_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'], @@ -2086,7 +2195,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2096,11 +2209,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2113,7 +2226,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2128,8 +2242,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2141,6 +2256,7 @@ 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 @@ -2162,12 +2278,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2180,6 +2295,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2191,6 +2307,7 @@ def _redeploy_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'], @@ -2198,7 +2315,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2208,11 +2329,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2226,7 +2347,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2241,8 +2363,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2254,6 +2377,7 @@ 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 @@ -2275,12 +2399,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2293,6 +2416,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2304,6 +2428,7 @@ def _perform_maintenance_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'], @@ -2311,7 +2436,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2321,11 +2450,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2341,7 +2470,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2356,8 +2486,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2369,6 +2500,7 @@ 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 @@ -2390,12 +2522,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2408,6 +2539,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2416,6 +2548,7 @@ def _update_instances_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'], @@ -2423,7 +2556,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2433,11 +2570,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2465,8 +2602,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2478,6 +2616,7 @@ 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 @@ -2499,12 +2638,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2517,6 +2655,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -2528,6 +2667,7 @@ def _reimage_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'], @@ -2535,7 +2675,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2545,11 +2689,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2564,7 +2708,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2019_03_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -2579,8 +2723,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2592,6 +2737,7 @@ 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 @@ -2613,12 +2759,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2631,6 +2776,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2642,6 +2788,7 @@ def _reimage_all_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'], @@ -2649,7 +2796,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2659,11 +2810,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2677,7 +2828,8 @@ 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. + :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.v2019_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2692,8 +2844,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2705,6 +2858,7 @@ 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 @@ -2726,10 +2880,9 @@ 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) + 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 + 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( @@ -2760,18 +2913,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -2785,11 +2945,11 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2816,6 +2976,7 @@ def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2824,6 +2985,7 @@ def convert_to_single_placement_group( 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'], @@ -2831,7 +2993,11 @@ def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2841,5 +3007,5 @@ 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_sizes_operations.py index 6d6236cbd10f..ed5d045093d6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,6 +99,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -109,6 +112,7 @@ def prepare_request(next_link=None): 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) @@ -119,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machines_operations.py index 71f83fd519f4..9b1b22d8f853 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -200,25 +201,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -231,33 +233,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -268,31 +271,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -303,25 +307,26 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -332,25 +337,26 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -361,25 +367,26 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -389,30 +396,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -421,29 +429,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -454,31 +463,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -491,27 +501,28 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -522,25 +533,26 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -551,25 +563,26 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -580,25 +593,26 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -612,33 +626,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -651,25 +665,26 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-03-01" + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -683,41 +698,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-03-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -756,6 +771,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -767,6 +784,7 @@ def prepare_request(next_link=None): 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) @@ -777,6 +795,7 @@ def prepare_request(next_link=None): 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) @@ -794,7 +813,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]: @@ -807,7 +830,7 @@ def get_next(next_link=None): 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, @@ -822,6 +845,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -830,6 +854,7 @@ def _capture_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'], @@ -837,7 +862,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -853,7 +882,7 @@ def _capture_initial( 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 @@ -887,8 +916,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -900,6 +930,7 @@ 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 @@ -924,10 +955,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -942,6 +972,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -950,6 +981,7 @@ def _create_or_update_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'], @@ -957,7 +989,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -975,7 +1011,7 @@ def _create_or_update_initial( 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 @@ -1007,8 +1043,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1020,6 +1057,7 @@ 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 @@ -1044,10 +1082,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1062,6 +1099,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1070,6 +1108,7 @@ def _update_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'], @@ -1077,7 +1116,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1095,7 +1138,7 @@ def _update_initial( 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 @@ -1127,8 +1170,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1140,6 +1184,7 @@ 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 @@ -1164,12 +1209,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1181,17 +1225,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1201,11 +1252,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1229,7 +1280,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1240,6 +1292,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1260,10 +1313,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1279,8 +1331,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1293,18 +1345,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -1318,7 +1377,7 @@ def get( 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 @@ -1345,17 +1404,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: 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) - 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]: @@ -1369,10 +1435,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1384,17 +1450,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1404,11 +1477,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1433,7 +1506,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1444,6 +1518,7 @@ 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 ) @@ -1464,12 +1539,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1481,17 +1555,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1501,11 +1582,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1530,7 +1611,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1541,6 +1623,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1561,13 +1644,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1590,17 +1672,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -1610,7 +1699,7 @@ 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 @@ -1631,6 +1720,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1642,6 +1733,7 @@ def prepare_request(next_link=None): 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) @@ -1652,6 +1744,7 @@ def prepare_request(next_link=None): 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) @@ -1669,7 +1762,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]: @@ -1682,7 +1779,7 @@ def get_next(next_link=None): 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( @@ -1699,6 +1796,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1709,6 +1808,7 @@ def prepare_request(next_link=None): 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) @@ -1718,6 +1818,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1735,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]: @@ -1748,7 +1853,7 @@ def get_next(next_link=None): 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( @@ -1771,6 +1876,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1783,6 +1890,7 @@ def prepare_request(next_link=None): 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) @@ -1794,6 +1902,7 @@ def prepare_request(next_link=None): 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) @@ -1811,7 +1920,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]: @@ -1824,9 +1937,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -1839,18 +1952,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -1860,11 +1980,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1880,7 +2000,7 @@ 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. @@ -1894,7 +2014,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1906,6 +2027,7 @@ 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 ) @@ -1926,12 +2048,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1943,17 +2064,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -1963,11 +2091,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1991,7 +2119,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2002,6 +2131,7 @@ 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 ) @@ -2022,12 +2152,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2039,17 +2168,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -2059,11 +2195,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2087,7 +2223,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2098,6 +2235,7 @@ 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 ) @@ -2118,12 +2256,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2135,17 +2272,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -2155,11 +2299,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2183,7 +2327,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2194,6 +2339,7 @@ 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 ) @@ -2214,12 +2360,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2232,6 +2377,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -2243,6 +2389,7 @@ def _reimage_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'], @@ -2250,7 +2397,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2260,11 +2411,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2277,7 +2428,8 @@ 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.v2019_03_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2291,8 +2443,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2304,6 +2457,7 @@ 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 @@ -2325,12 +2479,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2342,17 +2495,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + 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) - 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]: @@ -2362,11 +2522,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2390,7 +2550,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2401,6 +2562,7 @@ 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 ) @@ -2421,16 +2583,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore def _run_command_initial( self, resource_group_name: 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"]] @@ -2439,7 +2602,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-03-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2447,6 +2610,7 @@ def _run_command_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'], @@ -2454,7 +2618,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2470,7 +2638,7 @@ def _run_command_initial( 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 @@ -2479,6 +2647,8 @@ def begin_run_command( 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. @@ -2489,6 +2659,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_03_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 @@ -2502,8 +2675,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-03-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( 'polling_interval', @@ -2516,6 +2689,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2539,7 +2713,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py index fbc3c6da80b3..e50845b096bb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -31,8 +32,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -54,7 +58,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_configuration.py index 1d23f2385aac..ee45b3caec65 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2019-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-04-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json index e6add6226402..bb35e20f50ba 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py index 7a021673f43e..386767064d4c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -31,8 +32,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_configuration.py index 2f95acbe636f..40c4d0f1055b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/_configuration.py @@ -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 "2019-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-04-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_resource_skus_operations.py index e86ad9ee74f1..645fd985cee5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/aio/operations/_resource_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -55,7 +53,7 @@ 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 :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) @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_04_01.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -73,6 +73,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -83,6 +84,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py index 05f0998149eb..bcd1bd207d3e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/operations/_resource_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_list_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-04-01" + api_version = kwargs.pop('api_version', "2019-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -91,13 +92,15 @@ 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 :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.v2019_04_01.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -108,6 +111,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -118,6 +122,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py index e3f77bb556ba..d0b13ec11d7d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -103,8 +104,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-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. """ @@ -154,7 +158,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_configuration.py index 7a15fdda964e..e5232470c767 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2019-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json index da2208a2ccfd..5ee3c1e5d5f2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py index 25cf8cc6d18a..b7fd5fb17825 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -105,8 +106,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_configuration.py index 56462478dbaf..896b00e0650e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/_configuration.py @@ -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 "2019-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_availability_sets_operations.py index 9aa2cefb160b..c080ba725610 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_host_groups_operations.py index 83bc7650b660..a0aa46c4621d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -138,6 +143,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -146,6 +152,7 @@ async def update( 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'], @@ -153,7 +160,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -167,11 +178,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -194,17 +205,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -214,7 +232,7 @@ 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 @@ -241,17 +259,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -265,7 +290,7 @@ async def get( 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 @@ -286,6 +311,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -297,6 +324,7 @@ def prepare_request(next_link=None): 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) @@ -307,6 +335,7 @@ def prepare_request(next_link=None): 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) @@ -324,7 +353,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]: @@ -337,7 +370,7 @@ async def get_next(next_link=None): 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( @@ -354,6 +387,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +399,7 @@ def prepare_request(next_link=None): 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) @@ -373,6 +409,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -390,7 +427,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]: @@ -403,4 +444,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_hosts_operations.py index c7f9b17ec345..718ce3dcd209 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -255,8 +267,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,6 +282,7 @@ 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 @@ -293,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -311,18 +324,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -332,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -363,7 +383,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -375,6 +396,7 @@ 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 ) @@ -395,10 +417,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace_async async def get( @@ -417,8 +438,8 @@ async def get( :type host_group_name: str :param host_name: The name of the dedicated host. :type host_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -431,19 +452,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -457,7 +485,7 @@ async def get( 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 @@ -481,6 +509,8 @@ def list_by_host_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -493,6 +523,7 @@ def prepare_request(next_link=None): 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) @@ -504,6 +535,7 @@ def prepare_request(next_link=None): 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) @@ -521,7 +553,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]: @@ -534,4 +570,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disk_encryption_sets_operations.py index 26ac67750bc7..09dacdf5be75 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -130,8 +135,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -167,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -193,6 +200,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,7 +230,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -254,8 +266,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,6 +280,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -291,10 +305,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async async def get( @@ -322,17 +335,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -346,10 +366,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -361,17 +381,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -381,11 +408,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -411,7 +438,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -422,6 +450,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -442,10 +471,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -464,6 +492,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -475,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -485,6 +516,7 @@ def prepare_request(next_link=None): 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) @@ -502,7 +534,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]: @@ -515,7 +551,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -531,6 +567,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -541,6 +579,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -550,6 +589,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -567,7 +607,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]: @@ -580,4 +624,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disks_operations.py index b6c8d7d39a9d..116e3e876457 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_galleries_operations.py index 5a4326fc80f7..6c40aaff74f7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -97,7 +102,7 @@ async def _create_or_update_initial( 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 @@ -130,8 +135,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ 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 @@ -167,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'GalleryUpdate') @@ -193,6 +200,7 @@ async def _update_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'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -214,7 +226,7 @@ async def _update_initial( 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 @@ -247,8 +259,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -260,6 +273,7 @@ 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 @@ -284,10 +298,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace_async async def get( @@ -313,17 +326,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -337,10 +357,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -352,17 +372,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -372,11 +399,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -400,7 +427,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -411,6 +439,7 @@ 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 ) @@ -431,10 +460,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -452,6 +480,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -463,6 +493,7 @@ def prepare_request(next_link=None): 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) @@ -473,6 +504,7 @@ def prepare_request(next_link=None): 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) @@ -490,7 +522,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]: @@ -503,7 +539,7 @@ async def get_next(next_link=None): 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( @@ -518,6 +554,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -528,6 +566,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -537,6 +576,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -554,7 +594,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,4 +611,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_application_versions_operations.py index f3f4c0f6bf43..612edce119fa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -147,8 +152,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -162,6 +168,7 @@ 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 @@ -186,10 +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) + 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 + 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, @@ -206,6 +212,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') @@ -216,6 +223,7 @@ async def _update_initial( 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'], @@ -223,7 +231,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -237,7 +249,7 @@ async def _update_initial( 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 @@ -283,8 +295,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -298,6 +311,7 @@ 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 @@ -322,10 +336,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) + 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 + 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( @@ -350,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.v2019_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) @@ -363,6 +376,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -370,13 +385,18 @@ async def get( 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) - 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]: @@ -390,10 +410,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -407,6 +427,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -414,12 +436,17 @@ async def _delete_initial( 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) - 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]: @@ -429,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -466,7 +493,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -479,6 +507,7 @@ 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 ) @@ -499,10 +528,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) + 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 + 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( @@ -529,6 +557,8 @@ def list_by_gallery_application( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -542,6 +572,7 @@ def prepare_request(next_link=None): 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) @@ -554,6 +585,7 @@ def prepare_request(next_link=None): 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) @@ -571,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]: @@ -584,4 +620,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_applications_operations.py index c8de4cdfa608..162131f172de 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplication') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -139,8 +144,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -153,6 +159,7 @@ 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 @@ -177,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore async def _update_initial( self, @@ -196,6 +202,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') @@ -205,6 +212,7 @@ async def _update_initial( 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'], @@ -212,7 +220,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -265,8 +277,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,6 +292,7 @@ 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 @@ -303,10 +317,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace_async async def get( @@ -337,18 +350,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, + 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(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]: @@ -362,10 +382,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -378,18 +398,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -399,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -431,7 +458,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -443,6 +471,7 @@ 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 ) @@ -463,10 +492,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -489,6 +517,8 @@ def list_by_gallery( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -501,6 +531,7 @@ def prepare_request(next_link=None): 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) @@ -512,6 +543,7 @@ def prepare_request(next_link=None): 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) @@ -529,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]: @@ -542,4 +578,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_image_versions_operations.py index 006a0727aacd..9e707c41bf99 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -146,8 +151,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -161,6 +167,7 @@ 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 @@ -185,10 +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) + 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 + 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, @@ -205,6 +211,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') @@ -215,6 +222,7 @@ async def _update_initial( 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'], @@ -222,7 +230,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -236,7 +248,7 @@ async def _update_initial( 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 @@ -281,8 +293,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,6 +309,7 @@ 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 @@ -320,10 +334,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) + 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 + 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( @@ -347,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.v2019_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) @@ -360,6 +373,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -367,13 +382,18 @@ async def get( 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) - 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]: @@ -387,10 +407,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -404,6 +424,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -411,12 +433,17 @@ async def _delete_initial( 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) - 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]: @@ -426,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -462,7 +489,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -475,6 +503,7 @@ 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 ) @@ -495,10 +524,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) + 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 + 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( @@ -525,6 +553,8 @@ def list_by_gallery_image( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -538,6 +568,7 @@ def prepare_request(next_link=None): 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) @@ -550,6 +581,7 @@ def prepare_request(next_link=None): 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) @@ -567,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]: @@ -580,4 +616,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_images_operations.py index 203708944a16..0068844b61b3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,6 +157,7 @@ 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 @@ -175,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore async def _update_initial( self, @@ -194,6 +200,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') @@ -203,6 +210,7 @@ async def _update_initial( 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'], @@ -210,7 +218,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -224,7 +236,7 @@ async def _update_initial( 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 @@ -262,8 +274,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,6 +289,7 @@ 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 @@ -300,10 +314,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace_async async def get( @@ -333,18 +346,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, + 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(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]: @@ -358,10 +378,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -374,18 +394,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -395,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -427,7 +454,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -439,6 +467,7 @@ 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 ) @@ -459,10 +488,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -484,6 +512,8 @@ def list_by_gallery( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -496,6 +526,7 @@ def prepare_request(next_link=None): 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) @@ -507,6 +538,7 @@ def prepare_request(next_link=None): 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) @@ -524,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]: @@ -537,4 +573,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_images_operations.py index a05e9c52711a..c5f76f0af051 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_log_analytics_operations.py index 2a01cddda517..ff7c05ad5ba5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py index 7ad634a82108..0036c83a9b9a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_proximity_placement_groups_operations.py index 334fcd9a676e..2091b13e7dd6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -230,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) @@ -243,18 +261,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -268,7 +293,7 @@ async def get( 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 @@ -285,6 +310,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -295,6 +322,7 @@ def prepare_request(next_link=None): 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) @@ -304,6 +332,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -321,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]: @@ -334,7 +367,7 @@ async def get_next(next_link=None): 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( @@ -353,6 +386,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +399,7 @@ def prepare_request(next_link=None): 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) @@ -374,6 +410,7 @@ def prepare_request(next_link=None): 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) @@ -391,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]: @@ -404,4 +445,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_snapshots_operations.py index b4d63663ffb8..4acb049cf253 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_usage_operations.py index ba867180db3d..2b94a90e0438 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extension_images_operations.py index c8799853a203..56f3464de657 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extensions_operations.py index 5c99dc62ebb0..bd0643662b92 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_images_operations.py index 2d4b36037e02..d7d1113d27f5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_run_commands_operations.py index e5a976153d3f..f76885479889 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,7 +121,7 @@ async def get_next(next_link=None): 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( @@ -140,17 +147,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -164,5 +178,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index fd0ace2c5d45..d554d2e4a221 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore async def _update_initial( self, @@ -192,6 +198,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -201,6 +208,7 @@ async def _update_initial( 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'], @@ -208,7 +216,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -264,8 +276,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,6 +291,7 @@ 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 @@ -302,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -320,18 +333,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -341,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -372,7 +392,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -384,6 +405,7 @@ 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 ) @@ -404,10 +426,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -426,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) @@ -439,19 +460,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -465,7 +493,7 @@ async def get( 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 @@ -488,6 +516,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -500,6 +530,7 @@ def prepare_request(next_link=None): 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) @@ -511,6 +542,7 @@ def prepare_request(next_link=None): 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) @@ -528,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]: @@ -541,4 +577,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index e83c740f9f46..2448b0b173a8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,12 +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) + 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 + 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, @@ -252,17 +267,24 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -272,11 +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 @distributed_trace_async - async def begin_start_extension_upgrade( + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -302,7 +324,8 @@ async def begin_start_extension_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -313,6 +336,7 @@ 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 ) @@ -333,10 +357,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) + 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 + 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( @@ -362,17 +385,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -386,5 +416,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 6e778fc9b85e..4df90df55e8e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -136,8 +141,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,6 +157,7 @@ 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 @@ -175,10 +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) + 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 + 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, @@ -195,6 +201,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -205,6 +212,7 @@ async def _update_initial( 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'], @@ -212,7 +220,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -267,8 +279,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,6 +295,7 @@ 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 @@ -306,12 +320,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) + 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 + 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, @@ -325,6 +338,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -332,12 +347,17 @@ async def _delete_initial( 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) - 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]: @@ -347,11 +367,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -381,7 +401,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -394,6 +415,7 @@ 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 ) @@ -414,10 +436,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) + 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 + 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( @@ -439,7 +460,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: VirtualMachineExtension, or the result of cls(response) @@ -452,6 +473,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -459,13 +482,18 @@ async def get( 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) - 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]: @@ -479,7 +507,7 @@ async def get( 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 @@ -499,7 +527,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: VirtualMachineExtensionsListResult, or the result of cls(response) @@ -512,19 +540,26 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -538,5 +573,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 8d5f3ae0132d..69cf4ca73d18 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -62,6 +61,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -74,6 +74,7 @@ async def _reimage_initial( 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'], @@ -81,7 +82,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -112,6 +117,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -126,8 +132,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +147,7 @@ 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 @@ -161,12 +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) + 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 + 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, @@ -179,18 +186,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -200,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -232,7 +246,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -244,6 +259,7 @@ 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 ) @@ -264,12 +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) + 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 + 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, @@ -282,18 +297,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -303,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,7 +358,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -348,6 +371,7 @@ 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 ) @@ -368,10 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -387,6 +410,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -396,6 +420,7 @@ async def _update_initial( 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'], @@ -403,7 +428,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -421,7 +450,7 @@ async def _update_initial( 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 @@ -458,8 +487,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +502,7 @@ 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 @@ -496,12 +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) + 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 + 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, @@ -514,18 +544,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -535,11 +572,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -566,7 +603,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -578,6 +616,7 @@ async def begin_delete( 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 ) @@ -598,10 +637,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -620,8 +658,8 @@ async def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. :type instance_id: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -634,19 +672,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -660,7 +705,7 @@ async def get( 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 @@ -690,18 +735,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -715,7 +767,7 @@ async def get_instance_view( 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 @@ -736,12 +788,13 @@ 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 @@ -750,6 +803,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -762,6 +817,7 @@ def prepare_request(next_link=None): 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, @@ -776,6 +832,7 @@ def prepare_request(next_link=None): 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, @@ -796,7 +853,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]: @@ -809,9 +870,9 @@ async def get_next(next_link=None): 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, @@ -825,19 +886,26 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -847,11 +915,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -871,7 +939,7 @@ 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. @@ -885,7 +953,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -898,6 +967,7 @@ 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 ) @@ -918,12 +988,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -936,18 +1005,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -957,11 +1033,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -988,7 +1064,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1000,6 +1077,7 @@ 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 ) @@ -1020,12 +1098,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1038,18 +1115,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1059,11 +1143,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1090,7 +1174,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1102,6 +1187,7 @@ 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 ) @@ -1122,12 +1208,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1140,18 +1225,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1161,11 +1253,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1193,7 +1285,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1205,6 +1298,7 @@ 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 ) @@ -1225,12 +1319,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1243,18 +1336,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1264,11 +1364,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1296,7 +1396,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1308,6 +1409,7 @@ 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 ) @@ -1328,10 +1430,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore async def _run_command_initial( self, @@ -1339,6 +1440,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"]] @@ -1347,7 +1450,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-07-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1356,6 +1459,7 @@ async def _run_command_initial( 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'], @@ -1363,7 +1467,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1379,7 +1487,7 @@ async def _run_command_initial( 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 @@ -1389,6 +1497,8 @@ async def begin_run_command( 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. @@ -1401,6 +1511,9 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_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 @@ -1415,8 +1528,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1430,6 +1543,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1453,7 +1567,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_sets_operations.py index 79a39d142b9d..b49aff89230f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -190,6 +197,7 @@ async def _update_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'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -211,7 +223,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -318,11 +338,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -357,6 +378,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -406,17 +427,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,10 +458,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -446,6 +474,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -457,6 +486,7 @@ async def _deallocate_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'], @@ -464,7 +494,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -474,11 +508,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -493,7 +527,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -508,8 +543,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,6 +557,7 @@ 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 @@ -542,12 +579,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) + 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 + 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, @@ -560,6 +596,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -568,6 +605,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -575,7 +613,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -585,11 +627,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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -617,8 +659,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -630,6 +673,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -651,10 +695,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) + 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 + 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( @@ -680,17 +723,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -704,7 +754,7 @@ async def get_instance_view( 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 @@ -724,6 +774,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -735,6 +787,7 @@ def prepare_request(next_link=None): 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) @@ -745,6 +798,7 @@ def prepare_request(next_link=None): 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) @@ -762,7 +816,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]: @@ -775,7 +833,7 @@ async def get_next(next_link=None): 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( @@ -793,6 +851,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -803,6 +863,7 @@ def prepare_request(next_link=None): 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) @@ -812,6 +873,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -829,7 +891,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]: @@ -842,7 +908,7 @@ async def get_next(next_link=None): 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( @@ -865,6 +931,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -877,6 +945,7 @@ def prepare_request(next_link=None): 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) @@ -888,6 +957,7 @@ def prepare_request(next_link=None): 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) @@ -905,7 +975,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]: @@ -918,7 +992,7 @@ async def get_next(next_link=None): 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( @@ -940,6 +1014,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -952,6 +1028,7 @@ def prepare_request(next_link=None): 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) @@ -963,6 +1040,7 @@ def prepare_request(next_link=None): 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) @@ -980,7 +1058,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]: @@ -993,9 +1075,9 @@ async def get_next(next_link=None): 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, @@ -1009,6 +1091,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1020,6 +1103,7 @@ async def _power_off_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, @@ -1028,7 +1112,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1038,11 +1126,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1060,9 +1148,10 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1077,8 +1166,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1091,6 +1181,7 @@ 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 @@ -1112,12 +1203,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) + 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 + 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, @@ -1130,6 +1220,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1141,6 +1232,7 @@ async def _restart_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'], @@ -1148,7 +1240,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1158,11 +1254,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1175,7 +1271,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1190,8 +1287,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1203,6 +1301,7 @@ 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 @@ -1224,12 +1323,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) + 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 + 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, @@ -1242,6 +1340,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1253,6 +1352,7 @@ async def _start_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'], @@ -1260,7 +1360,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +1374,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1287,7 +1391,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1302,8 +1407,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1315,6 +1421,7 @@ 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 @@ -1336,12 +1443,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) + 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 + 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, @@ -1354,6 +1460,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1365,6 +1472,7 @@ async def _redeploy_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'], @@ -1372,7 +1480,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1382,11 +1494,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1400,7 +1512,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1415,8 +1528,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1428,6 +1542,7 @@ 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 @@ -1449,12 +1564,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1467,6 +1581,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1478,6 +1593,7 @@ async def _perform_maintenance_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'], @@ -1485,7 +1601,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1495,11 +1615,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1515,7 +1635,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1530,8 +1651,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1543,6 +1665,7 @@ 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 @@ -1564,12 +1687,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1582,6 +1704,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1590,6 +1713,7 @@ async def _update_instances_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'], @@ -1597,7 +1721,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1607,11 +1735,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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1639,8 +1767,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1652,6 +1781,7 @@ 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 @@ -1673,12 +1803,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) + 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 + 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, @@ -1691,6 +1820,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -1702,6 +1832,7 @@ async def _reimage_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'], @@ -1709,7 +1840,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1719,11 +1854,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1738,7 +1873,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -1753,8 +1888,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1766,6 +1902,7 @@ 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 @@ -1787,12 +1924,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1805,6 +1941,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1816,6 +1953,7 @@ async def _reimage_all_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'], @@ -1823,7 +1961,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1833,11 +1975,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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1851,7 +1993,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1866,8 +2009,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1879,6 +2023,7 @@ 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 @@ -1900,10 +2045,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) + 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 + 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( @@ -1934,18 +2078,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -1959,11 +2110,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + async def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1990,6 +2141,7 @@ async def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -1998,6 +2150,7 @@ async def convert_to_single_placement_group( 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'], @@ -2005,7 +2158,11 @@ async def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2015,5 +2172,5 @@ 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_sizes_operations.py index 0b43645dbda9..6f1502045fdb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -64,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -85,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -102,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]: @@ -115,4 +121,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machines_operations.py index 72a4610229eb..efe469c293a6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -318,8 +338,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,6 +352,7 @@ 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 @@ -355,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -373,6 +394,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -381,6 +403,7 @@ async def _update_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'], @@ -388,7 +411,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -406,7 +433,7 @@ async def _update_initial( 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 @@ -439,8 +466,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -452,6 +480,7 @@ 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 @@ -476,12 +505,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) + 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 + 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, @@ -493,17 +521,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -513,11 +548,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -541,7 +576,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -552,6 +588,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -572,10 +609,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -591,8 +627,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -605,18 +641,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -630,7 +673,7 @@ async def get( 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 @@ -657,17 +700,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -681,10 +731,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -696,17 +746,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -716,11 +773,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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -749,7 +806,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -760,6 +818,7 @@ 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 ) @@ -780,12 +839,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) + 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 + 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, @@ -797,17 +855,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -817,11 +882,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -846,7 +911,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -857,6 +923,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -877,13 +944,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -911,17 +977,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -931,7 +1004,7 @@ 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 @@ -952,6 +1025,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -963,6 +1038,7 @@ def prepare_request(next_link=None): 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) @@ -973,6 +1049,7 @@ def prepare_request(next_link=None): 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) @@ -990,7 +1067,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]: @@ -1003,7 +1084,7 @@ async def get_next(next_link=None): 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( @@ -1015,7 +1096,7 @@ 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 @@ -1024,6 +1105,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1034,6 +1117,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1044,6 +1128,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1062,7 +1147,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,7 +1164,7 @@ async def get_next(next_link=None): 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( @@ -1098,6 +1187,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1110,6 +1201,7 @@ def prepare_request(next_link=None): 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) @@ -1121,6 +1213,7 @@ def prepare_request(next_link=None): 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) @@ -1138,7 +1231,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]: @@ -1151,9 +1248,9 @@ async def get_next(next_link=None): 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, @@ -1166,18 +1263,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -1187,11 +1291,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1207,7 +1311,7 @@ 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. @@ -1221,7 +1325,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1233,6 +1338,7 @@ 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 ) @@ -1253,12 +1359,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _reapply_initial( + async def _reapply_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1270,17 +1375,24 @@ async def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -1290,11 +1402,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 @distributed_trace_async - async def begin_reapply( + async def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1318,7 +1430,8 @@ async def begin_reapply( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1329,6 +1442,7 @@ 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 ) @@ -1349,12 +1463,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) + 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 + begin_reapply.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1366,17 +1479,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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,11 +1506,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1414,7 +1534,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1425,6 +1546,7 @@ 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 ) @@ -1445,12 +1567,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) + 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 + 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, @@ -1462,17 +1583,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -1482,11 +1610,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1510,7 +1638,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1521,6 +1650,7 @@ 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 ) @@ -1541,12 +1671,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) + 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 + 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, @@ -1558,17 +1687,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -1578,11 +1714,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1606,7 +1742,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1617,6 +1754,7 @@ 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 ) @@ -1637,12 +1775,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) + 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 + 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, @@ -1655,6 +1792,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1666,6 +1804,7 @@ async def _reimage_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'], @@ -1673,7 +1812,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1683,11 +1826,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1700,7 +1843,8 @@ 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.v2019_07_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1714,8 +1858,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1727,6 +1872,7 @@ 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 @@ -1748,12 +1894,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1765,17 +1910,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -1785,11 +1937,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1814,7 +1966,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1825,6 +1978,7 @@ 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 ) @@ -1845,16 +1999,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # 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"]] @@ -1863,7 +2018,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-07-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1871,6 +2026,7 @@ async def _run_command_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'], @@ -1878,7 +2034,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1894,7 +2054,7 @@ async def _run_command_initial( 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 @@ -1903,6 +2063,8 @@ async def begin_run_command( 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. @@ -1913,6 +2075,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_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 @@ -1927,8 +2092,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_07_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1941,6 +2106,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1964,7 +2130,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_availability_sets_operations.py index be5d4be4ee96..eb10f7054873 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -185,31 +187,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -253,31 +257,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,6 +335,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -338,6 +344,7 @@ def create_or_update( 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'], @@ -345,7 +352,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -359,7 +370,7 @@ def create_or_update( 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 @@ -389,6 +400,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -397,6 +409,7 @@ def update( 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'], @@ -404,7 +417,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +435,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -445,17 +462,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -465,7 +489,7 @@ 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 @@ -492,17 +516,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -516,7 +547,7 @@ def get( 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 @@ -528,7 +559,7 @@ 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 @@ -537,6 +568,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -547,6 +580,7 @@ def prepare_request(next_link=None): 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'], ) @@ -557,6 +591,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -575,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]: @@ -588,7 +627,7 @@ def get_next(next_link=None): 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( @@ -607,6 +646,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -618,6 +659,7 @@ def prepare_request(next_link=None): 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) @@ -628,6 +670,7 @@ def prepare_request(next_link=None): 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) @@ -645,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]: @@ -658,7 +705,7 @@ def get_next(next_link=None): 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( @@ -681,6 +728,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_host_groups_operations.py index 4809a290f683..f29cb63734f8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -184,30 +186,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -216,29 +219,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -293,6 +297,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -301,6 +306,7 @@ def create_or_update( 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'], @@ -308,7 +314,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -326,7 +336,7 @@ def create_or_update( 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 @@ -356,6 +366,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -364,6 +375,7 @@ def update( 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'], @@ -371,7 +383,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,11 +401,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -412,17 +428,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -432,7 +455,7 @@ 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 @@ -459,17 +482,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -483,7 +513,7 @@ def get( 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 @@ -504,6 +534,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -515,6 +547,7 @@ def prepare_request(next_link=None): 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) @@ -525,6 +558,7 @@ def prepare_request(next_link=None): 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) @@ -542,7 +576,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]: @@ -555,7 +593,7 @@ def get_next(next_link=None): 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( @@ -572,6 +610,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -582,6 +622,7 @@ def prepare_request(next_link=None): 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) @@ -591,6 +632,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -608,7 +650,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]: @@ -621,4 +667,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_hosts_operations.py index 8844782dc51b..1c4bd15c6a0c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_by_host_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -332,8 +341,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -346,6 +356,7 @@ 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 @@ -370,10 +381,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore def _update_initial( self, @@ -389,6 +399,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -398,6 +409,7 @@ def _update_initial( 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'], @@ -405,7 +417,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,7 +435,7 @@ def _update_initial( 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 @@ -454,8 +470,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,6 +485,7 @@ 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 @@ -492,12 +510,11 @@ 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) + 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 + 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: str, host_group_name: str, @@ -510,18 +527,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -531,11 +555,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -562,7 +586,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -574,6 +599,7 @@ 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 ) @@ -594,10 +620,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace def get( @@ -616,8 +641,8 @@ def get( :type host_group_name: str :param host_name: The name of the dedicated host. :type host_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -630,19 +655,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -656,7 +688,7 @@ def get( 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 @@ -680,6 +712,8 @@ def list_by_host_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -692,6 +726,7 @@ def prepare_request(next_link=None): 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) @@ -703,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -720,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]: @@ -733,4 +773,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disk_encryption_sets_operations.py index 55af44c46e65..c8c6915b43ce 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -285,6 +289,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -293,6 +298,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -300,7 +306,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -318,7 +328,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -353,8 +363,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -366,6 +377,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -390,10 +402,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore def _update_initial( self, @@ -408,6 +419,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -416,6 +428,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -423,7 +436,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -441,7 +458,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -476,8 +493,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -489,6 +507,7 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -513,10 +532,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def get( @@ -544,17 +562,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -568,10 +593,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -583,17 +608,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -603,11 +635,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -633,7 +665,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -644,6 +677,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -664,10 +698,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -686,6 +719,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -697,6 +732,7 @@ def prepare_request(next_link=None): 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) @@ -707,6 +743,7 @@ def prepare_request(next_link=None): 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) @@ -724,7 +761,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]: @@ -737,7 +778,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -753,6 +794,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -763,6 +806,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -772,6 +816,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -789,7 +834,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]: @@ -802,4 +851,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disks_operations.py index 507976595c31..0b04886a0df3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_galleries_operations.py index 67f2008e2ad2..0119a043f720 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -285,6 +289,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -293,6 +298,7 @@ def _create_or_update_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'], @@ -300,7 +306,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -321,7 +331,7 @@ def _create_or_update_initial( 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 @@ -353,8 +363,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -366,6 +377,7 @@ 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 @@ -390,10 +402,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore def _update_initial( self, @@ -408,6 +419,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'GalleryUpdate') @@ -416,6 +428,7 @@ def _update_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'], @@ -423,7 +436,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -437,7 +454,7 @@ def _update_initial( 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 @@ -469,8 +486,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -482,6 +500,7 @@ 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 @@ -506,10 +525,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def get( @@ -535,17 +553,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -559,10 +584,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -574,17 +599,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -594,11 +626,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -622,7 +654,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -633,6 +666,7 @@ 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 ) @@ -653,10 +687,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -673,6 +706,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -684,6 +719,7 @@ def prepare_request(next_link=None): 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) @@ -694,6 +730,7 @@ def prepare_request(next_link=None): 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) @@ -711,7 +748,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]: @@ -724,7 +765,7 @@ def get_next(next_link=None): 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( @@ -738,6 +779,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -748,6 +791,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -757,6 +801,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -774,7 +819,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]: @@ -787,4 +836,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_application_versions_operations.py index 5b85ed819fa0..706cc56adf3d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -135,10 +135,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -147,23 +148,23 @@ def build_get_request( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -176,10 +177,11 @@ def build_delete_request_initial( gallery_application_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -188,21 +190,21 @@ def build_delete_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -214,10 +216,11 @@ def build_list_by_gallery_application_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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') + _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'), @@ -225,21 +228,21 @@ def build_list_by_gallery_application_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -280,6 +283,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') @@ -290,6 +294,7 @@ def _create_or_update_initial( 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'], @@ -297,7 +302,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -364,8 +373,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -379,6 +389,7 @@ 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 @@ -403,10 +414,9 @@ 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) + 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 + 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, @@ -423,6 +433,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') @@ -433,6 +444,7 @@ def _update_initial( 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'], @@ -440,7 +452,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -454,7 +470,7 @@ def _update_initial( 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 @@ -500,8 +516,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -515,6 +532,7 @@ 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 @@ -539,10 +557,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore @distributed_trace def get( @@ -567,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.v2019_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) @@ -580,6 +597,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -587,13 +606,18 @@ def get( 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) - 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]: @@ -607,10 +631,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -624,6 +648,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -631,12 +657,17 @@ def _delete_initial( 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) - 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]: @@ -646,11 +677,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -683,7 +714,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -696,6 +728,7 @@ 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 ) @@ -716,10 +749,9 @@ 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) + 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 + 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( @@ -746,6 +778,8 @@ def list_by_gallery_application( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -759,6 +793,7 @@ def prepare_request(next_link=None): 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) @@ -771,6 +806,7 @@ def prepare_request(next_link=None): 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) @@ -788,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]: @@ -801,4 +841,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_applications_operations.py index d5c47ba519c1..eb4505eaf450 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_get_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -139,21 +140,21 @@ def build_get_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,10 +166,11 @@ def build_delete_request_initial( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -176,21 +178,21 @@ def build_delete_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -201,31 +203,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,6 +268,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplication') @@ -274,6 +278,7 @@ def _create_or_update_initial( 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'], @@ -281,7 +286,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -302,7 +311,7 @@ def _create_or_update_initial( 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 @@ -342,8 +351,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -356,6 +366,7 @@ 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 @@ -380,10 +391,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore def _update_initial( self, @@ -399,6 +409,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') @@ -408,6 +419,7 @@ def _update_initial( 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'], @@ -415,7 +427,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -429,7 +445,7 @@ def _update_initial( 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 @@ -468,8 +484,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -482,6 +499,7 @@ 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 @@ -506,10 +524,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def get( @@ -540,18 +557,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, + 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(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]: @@ -565,10 +589,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -581,18 +605,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -602,11 +633,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -634,7 +665,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -646,6 +678,7 @@ 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 ) @@ -666,10 +699,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -692,6 +724,8 @@ def list_by_gallery( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -704,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -715,6 +750,7 @@ def prepare_request(next_link=None): 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) @@ -732,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]: @@ -745,4 +785,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_image_versions_operations.py index b07f7815c7cc..9922d1af01a3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -135,10 +135,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -147,23 +148,23 @@ def build_get_request( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -176,10 +177,11 @@ def build_delete_request_initial( gallery_image_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -188,21 +190,21 @@ def build_delete_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -214,10 +216,11 @@ def build_list_by_gallery_image_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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') + _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'), @@ -225,21 +228,21 @@ def build_list_by_gallery_image_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -280,6 +283,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -290,6 +294,7 @@ def _create_or_update_initial( 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'], @@ -297,7 +302,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -363,8 +372,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -378,6 +388,7 @@ 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 @@ -402,10 +413,9 @@ 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) + 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 + 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, @@ -422,6 +432,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') @@ -432,6 +443,7 @@ def _update_initial( 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'], @@ -439,7 +451,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -453,7 +469,7 @@ def _update_initial( 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 @@ -498,8 +514,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -513,6 +530,7 @@ 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 @@ -537,10 +555,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore @distributed_trace def get( @@ -564,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.v2019_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) @@ -577,6 +594,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -584,13 +603,18 @@ def get( 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) - 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]: @@ -604,10 +628,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -621,6 +645,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -628,12 +654,17 @@ def _delete_initial( 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) - 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]: @@ -643,11 +674,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -679,7 +710,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -692,6 +724,7 @@ 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 ) @@ -712,10 +745,9 @@ 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) + 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 + 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( @@ -742,6 +774,8 @@ def list_by_gallery_image( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -755,6 +789,7 @@ def prepare_request(next_link=None): 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) @@ -767,6 +802,7 @@ def prepare_request(next_link=None): 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) @@ -784,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]: @@ -797,4 +837,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_images_operations.py index e84938151a5f..55d5f78961b6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_get_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -139,21 +140,21 @@ def build_get_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,10 +166,11 @@ def build_delete_request_initial( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -176,21 +178,21 @@ def build_delete_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -201,31 +203,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,6 +268,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -274,6 +278,7 @@ def _create_or_update_initial( 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'], @@ -281,7 +286,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -302,7 +311,7 @@ def _create_or_update_initial( 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 @@ -340,8 +349,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -354,6 +364,7 @@ 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 @@ -378,10 +389,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore def _update_initial( self, @@ -397,6 +407,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') @@ -406,6 +417,7 @@ def _update_initial( 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'], @@ -413,7 +425,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,10 +521,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def get( @@ -536,18 +553,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, + 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(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]: @@ -561,10 +585,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -577,18 +601,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -598,11 +629,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -630,7 +661,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -642,6 +674,7 @@ 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 ) @@ -662,10 +695,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -686,6 +718,8 @@ def list_by_gallery( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -698,6 +732,7 @@ def prepare_request(next_link=None): 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) @@ -709,6 +744,7 @@ def prepare_request(next_link=None): 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) @@ -726,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]: @@ -739,4 +779,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_images_operations.py index 99f6acb24308..856469ffbbd9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -154,33 +155,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -291,6 +296,7 @@ def _create_or_update_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'], @@ -298,7 +304,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -316,7 +326,7 @@ def _create_or_update_initial( 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 @@ -347,8 +357,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -360,6 +371,7 @@ 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 @@ -384,10 +396,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -402,6 +413,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -410,6 +422,7 @@ def _update_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'], @@ -417,7 +430,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -435,7 +452,7 @@ def _update_initial( 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 @@ -466,8 +483,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +497,7 @@ 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 @@ -503,12 +522,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -520,17 +538,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -540,11 +565,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -568,7 +593,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -579,6 +605,7 @@ 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 ) @@ -599,10 +626,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -618,7 +644,7 @@ 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) @@ -631,18 +657,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -656,7 +689,7 @@ def get( 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 @@ -674,6 +707,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -685,6 +720,7 @@ def prepare_request(next_link=None): 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) @@ -695,6 +731,7 @@ def prepare_request(next_link=None): 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) @@ -712,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]: @@ -725,7 +766,7 @@ def get_next(next_link=None): 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( @@ -740,6 +781,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -750,6 +793,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -759,6 +803,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -776,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]: @@ -789,4 +838,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_log_analytics_operations.py index 1c6c70158cf1..ef4ade883db2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py index 7977fe32500f..36aed9fa6ae1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_proximity_placement_groups_operations.py index 14f31ae6ad19..03bb79092a9f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( include_colocation_status: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -187,29 +189,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -295,6 +299,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -303,6 +308,7 @@ def create_or_update( 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'], @@ -310,7 +316,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -328,7 +338,7 @@ def create_or_update( 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 @@ -358,6 +368,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -366,6 +377,7 @@ def update( 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'], @@ -373,7 +385,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -387,11 +403,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -414,17 +430,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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,7 +457,7 @@ 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 @@ -452,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) @@ -465,18 +488,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -490,7 +520,7 @@ def get( 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 @@ -507,6 +537,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -517,6 +549,7 @@ def prepare_request(next_link=None): 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) @@ -526,6 +559,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -543,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]: @@ -556,7 +594,7 @@ def get_next(next_link=None): 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( @@ -575,6 +613,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -586,6 +626,7 @@ def prepare_request(next_link=None): 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) @@ -596,6 +637,7 @@ def prepare_request(next_link=None): 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) @@ -613,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]: @@ -626,4 +672,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_snapshots_operations.py index a9fde3060211..6ed670e686ff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_usage_operations.py index 692d746ace1c..736a0cb633cd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extension_images_operations.py index 24ba8adebfa6..e42a89460d1a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extensions_operations.py index 397fcd24745f..862545e769ae 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,9 +127,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -137,16 +138,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -160,10 +161,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -171,23 +173,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -200,33 +202,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,6 +269,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -275,6 +279,7 @@ def _create_or_update_initial( 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'], @@ -282,7 +287,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -300,7 +309,7 @@ def _create_or_update_initial( 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 @@ -338,8 +347,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,6 +362,7 @@ 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 @@ -376,10 +387,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -395,6 +405,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -404,6 +415,7 @@ def _update_initial( 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'], @@ -411,7 +423,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -425,7 +441,7 @@ def _update_initial( 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 @@ -463,8 +479,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,6 +494,7 @@ 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 @@ -501,12 +519,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -519,18 +536,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -540,11 +564,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -571,7 +595,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -583,6 +608,7 @@ 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 ) @@ -603,10 +629,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -625,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) @@ -638,19 +663,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -664,7 +696,7 @@ def get( 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 @@ -681,7 +713,7 @@ 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) @@ -694,18 +726,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -719,5 +758,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_images_operations.py index cc3c0c3ae7dd..aea695c13007 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_run_commands_operations.py index 58f90ce2606e..8798bb1e0c43 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -65,31 +66,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -132,6 +134,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -143,6 +147,7 @@ def prepare_request(next_link=None): 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) @@ -153,6 +158,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -170,7 +176,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]: @@ -183,7 +193,7 @@ def get_next(next_link=None): 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( @@ -209,17 +219,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -233,5 +250,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_extensions_operations.py index 2b6fa99c4f3f..865a4542613c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -336,8 +345,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -350,6 +360,7 @@ 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 @@ -374,10 +385,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore def _update_initial( self, @@ -393,6 +403,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -402,6 +413,7 @@ def _update_initial( 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'], @@ -409,7 +421,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,12 +521,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -521,18 +538,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -542,11 +566,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -573,7 +597,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -585,6 +610,7 @@ 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 ) @@ -605,10 +631,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -627,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) @@ -640,19 +665,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -666,7 +698,7 @@ def get( 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 @@ -689,6 +721,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -701,6 +735,7 @@ def prepare_request(next_link=None): 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) @@ -712,6 +747,7 @@ def prepare_request(next_link=None): 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) @@ -729,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]: @@ -742,4 +782,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 2b039141d121..d571930785ed 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,25 +33,26 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -62,25 +63,26 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -91,25 +93,26 @@ def build_start_extension_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -120,31 +123,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -170,7 +174,7 @@ 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: str, vm_scale_set_name: str, @@ -182,17 +186,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -202,11 +213,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -230,7 +241,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -241,6 +253,7 @@ 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 ) @@ -261,12 +274,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -278,17 +290,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,11 +317,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -328,7 +347,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -339,6 +359,7 @@ 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 ) @@ -359,12 +380,11 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def _start_extension_upgrade_initial( + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -376,17 +396,24 @@ def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -396,11 +423,11 @@ 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 @distributed_trace - def begin_start_extension_upgrade( + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -426,7 +453,8 @@ def begin_start_extension_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -437,6 +465,7 @@ 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 ) @@ -457,10 +486,9 @@ 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) + 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 + begin_start_extension_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -486,17 +514,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -510,5 +545,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index dfd79d0d6fbc..93a1ab3915ff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -53,23 +53,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -87,12 +87,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -101,23 +101,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -132,10 +132,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -144,21 +145,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -173,10 +174,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -185,23 +187,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,10 +217,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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') + _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'), @@ -226,23 +229,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +286,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -293,6 +297,7 @@ def _create_or_update_initial( 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'], @@ -300,7 +305,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -358,8 +367,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -373,6 +383,7 @@ 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 @@ -397,10 +408,9 @@ 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) + 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 + 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, @@ -417,6 +427,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -427,6 +438,7 @@ def _update_initial( 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'], @@ -434,7 +446,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -448,7 +464,7 @@ def _update_initial( 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 @@ -489,8 +505,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -504,6 +521,7 @@ 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 @@ -528,12 +546,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -547,6 +564,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -554,12 +573,17 @@ def _delete_initial( 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) - 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]: @@ -569,11 +593,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -603,7 +627,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -616,6 +641,7 @@ 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 ) @@ -636,10 +662,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -661,7 +686,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: VirtualMachineExtension, or the result of cls(response) @@ -674,6 +699,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -681,13 +708,18 @@ def get( 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) - 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]: @@ -701,7 +733,7 @@ def get( 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 @@ -721,7 +753,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: VirtualMachineExtensionsListResult, or the result of cls(response) @@ -734,19 +766,26 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -760,5 +799,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py index b13468b0b94c..3b6034a21850 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,11 +39,11 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -51,22 +51,22 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,9 +80,10 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -90,16 +91,16 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -111,9 +112,10 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -121,16 +123,16 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -145,12 +147,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -158,23 +160,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -188,9 +190,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -198,16 +201,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -221,10 +224,11 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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}') + _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'), @@ -232,23 +236,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -260,10 +264,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-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') + _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'), @@ -271,21 +276,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -300,37 +305,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -344,9 +350,10 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -354,18 +361,18 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -377,9 +384,10 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -387,16 +395,16 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -408,9 +416,10 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -418,16 +427,16 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -439,9 +448,10 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -449,16 +459,16 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -470,9 +480,10 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -480,16 +491,16 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -504,12 +515,12 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -517,29 +528,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -561,7 +572,7 @@ 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: str, vm_scale_set_name: str, @@ -575,6 +586,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -587,6 +599,7 @@ def _reimage_initial( 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'], @@ -594,7 +607,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -604,11 +621,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -625,6 +642,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -639,8 +657,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -653,6 +672,7 @@ 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 @@ -674,12 +694,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -692,18 +711,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -713,11 +739,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -745,7 +771,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -757,6 +784,7 @@ 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 ) @@ -777,12 +805,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -795,18 +822,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -816,11 +850,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -849,7 +883,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -861,6 +896,7 @@ 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 ) @@ -881,10 +917,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -900,6 +935,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -909,6 +945,7 @@ def _update_initial( 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'], @@ -916,7 +953,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -934,7 +975,7 @@ def _update_initial( 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 @@ -971,8 +1012,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -985,6 +1027,7 @@ 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 @@ -1009,12 +1052,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1027,18 +1069,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1048,11 +1097,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1079,7 +1128,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1091,6 +1141,7 @@ def begin_delete( 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 ) @@ -1111,10 +1162,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1133,8 +1183,8 @@ def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. :type instance_id: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -1147,19 +1197,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -1173,7 +1230,7 @@ def get( 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 @@ -1203,18 +1260,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -1228,7 +1292,7 @@ def get_instance_view( 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 @@ -1249,12 +1313,13 @@ 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 @@ -1263,6 +1328,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1275,6 +1342,7 @@ def prepare_request(next_link=None): 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, @@ -1289,6 +1357,7 @@ def prepare_request(next_link=None): 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, @@ -1309,7 +1378,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]: @@ -1322,9 +1395,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1338,19 +1411,26 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-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) - 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]: @@ -1360,11 +1440,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1384,7 +1464,7 @@ 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. @@ -1398,7 +1478,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1411,6 +1492,7 @@ 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 ) @@ -1431,12 +1513,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1449,18 +1530,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1470,11 +1558,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1501,7 +1589,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1513,6 +1602,7 @@ 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 ) @@ -1533,12 +1623,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1551,18 +1640,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1572,11 +1668,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1603,7 +1699,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1615,6 +1712,7 @@ 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 ) @@ -1635,12 +1733,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1653,18 +1750,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1674,11 +1778,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1706,7 +1810,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1718,6 +1823,7 @@ 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 ) @@ -1738,12 +1844,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1756,18 +1861,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1777,11 +1889,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1809,7 +1921,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1821,6 +1934,7 @@ 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 ) @@ -1841,10 +1955,9 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore def _run_command_initial( self, @@ -1852,6 +1965,8 @@ 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"]] @@ -1860,7 +1975,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-07-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1869,6 +1984,7 @@ def _run_command_initial( 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'], @@ -1876,7 +1992,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1892,7 +2012,7 @@ def _run_command_initial( 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 @@ -1902,6 +2022,8 @@ def begin_run_command( 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. @@ -1914,6 +2036,9 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_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 @@ -1927,8 +2052,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1942,6 +2067,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1965,7 +2091,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_sets_operations.py index 8776582ddae3..186762da69b7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,31 +153,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,33 +192,33 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -232,33 +234,33 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -271,31 +273,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -305,30 +308,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -337,29 +341,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -370,31 +375,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -405,31 +411,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -444,35 +451,35 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -488,33 +495,33 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -530,33 +537,33 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -572,33 +579,33 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -614,33 +621,33 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -656,33 +663,33 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -698,33 +705,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -740,33 +747,33 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -781,32 +788,33 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -820,39 +828,39 @@ def build_convert_to_single_placement_group_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -887,6 +895,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -895,6 +904,7 @@ def _create_or_update_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'], @@ -902,7 +912,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -920,7 +934,7 @@ def _create_or_update_initial( 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 @@ -953,8 +967,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -966,6 +981,7 @@ 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 @@ -990,10 +1006,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -1008,6 +1023,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -1016,6 +1032,7 @@ def _update_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'], @@ -1023,7 +1040,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1037,7 +1058,7 @@ def _update_initial( 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 @@ -1070,8 +1091,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1083,6 +1105,7 @@ 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 @@ -1107,12 +1130,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1124,17 +1146,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1144,11 +1173,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1172,7 +1201,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1183,6 +1213,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -1203,10 +1234,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1232,17 +1262,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1256,10 +1293,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1272,6 +1309,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1283,6 +1321,7 @@ def _deallocate_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'], @@ -1290,7 +1329,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1300,11 +1343,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1319,7 +1362,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1334,8 +1378,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1347,6 +1392,7 @@ 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 @@ -1368,12 +1414,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1386,6 +1431,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1394,6 +1440,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1401,7 +1448,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1411,11 +1462,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1443,8 +1494,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1456,6 +1508,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1477,10 +1530,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1506,17 +1558,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -1530,7 +1589,7 @@ def get_instance_view( 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 @@ -1550,6 +1609,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1561,6 +1622,7 @@ def prepare_request(next_link=None): 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) @@ -1571,6 +1633,7 @@ def prepare_request(next_link=None): 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) @@ -1588,7 +1651,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]: @@ -1601,7 +1668,7 @@ def get_next(next_link=None): 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( @@ -1619,6 +1686,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1629,6 +1698,7 @@ def prepare_request(next_link=None): 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) @@ -1638,6 +1708,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1655,7 +1726,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]: @@ -1668,7 +1743,7 @@ def get_next(next_link=None): 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( @@ -1691,6 +1766,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1703,6 +1780,7 @@ def prepare_request(next_link=None): 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) @@ -1714,6 +1792,7 @@ def prepare_request(next_link=None): 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) @@ -1731,7 +1810,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]: @@ -1744,7 +1827,7 @@ def get_next(next_link=None): 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( @@ -1766,6 +1849,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1778,6 +1863,7 @@ def prepare_request(next_link=None): 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) @@ -1789,6 +1875,7 @@ def prepare_request(next_link=None): 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) @@ -1806,7 +1893,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]: @@ -1819,9 +1910,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1835,6 +1926,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1846,6 +1938,7 @@ def _power_off_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, @@ -1854,7 +1947,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1864,11 +1961,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1886,9 +1983,10 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1903,8 +2001,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1917,6 +2016,7 @@ 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 @@ -1938,12 +2038,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1956,6 +2055,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1967,6 +2067,7 @@ def _restart_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'], @@ -1974,7 +2075,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1984,11 +2089,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2001,7 +2106,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2016,8 +2122,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2029,6 +2136,7 @@ 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 @@ -2050,12 +2158,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2068,6 +2175,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2079,6 +2187,7 @@ def _start_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'], @@ -2086,7 +2195,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2096,11 +2209,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2113,7 +2226,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2128,8 +2242,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2141,6 +2256,7 @@ 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 @@ -2162,12 +2278,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2180,6 +2295,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2191,6 +2307,7 @@ def _redeploy_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'], @@ -2198,7 +2315,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2208,11 +2329,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2226,7 +2347,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2241,8 +2363,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2254,6 +2377,7 @@ 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 @@ -2275,12 +2399,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2293,6 +2416,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2304,6 +2428,7 @@ def _perform_maintenance_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'], @@ -2311,7 +2436,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2321,11 +2450,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2341,7 +2470,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2356,8 +2486,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2369,6 +2500,7 @@ 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 @@ -2390,12 +2522,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2408,6 +2539,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2416,6 +2548,7 @@ def _update_instances_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'], @@ -2423,7 +2556,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2433,11 +2570,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2465,8 +2602,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2478,6 +2616,7 @@ 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 @@ -2499,12 +2638,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2517,6 +2655,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -2528,6 +2667,7 @@ def _reimage_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'], @@ -2535,7 +2675,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2545,11 +2689,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2564,7 +2708,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2019_07_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -2579,8 +2723,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2592,6 +2737,7 @@ 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 @@ -2613,12 +2759,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2631,6 +2776,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2642,6 +2788,7 @@ def _reimage_all_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'], @@ -2649,7 +2796,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2659,11 +2810,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2677,7 +2828,8 @@ 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. + :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.v2019_07_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2692,8 +2844,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2705,6 +2858,7 @@ 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 @@ -2726,10 +2880,9 @@ 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) + 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 + 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( @@ -2760,18 +2913,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -2785,11 +2945,11 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2816,6 +2976,7 @@ def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2824,6 +2985,7 @@ def convert_to_single_placement_group( 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'], @@ -2831,7 +2993,11 @@ def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2841,5 +3007,5 @@ 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_sizes_operations.py index 07973ddf09ed..333091724754 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,6 +99,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -109,6 +112,7 @@ def prepare_request(next_link=None): 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) @@ -119,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py index 98259df8f5b2..1128b3f340d8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -200,25 +201,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -231,33 +233,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -268,31 +271,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -303,25 +307,26 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -332,25 +337,26 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -361,25 +367,26 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -389,30 +396,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -423,31 +431,32 @@ def build_list_all_request( status_only: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -458,31 +467,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -495,27 +505,28 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -526,31 +537,32 @@ def build_reapply_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -561,25 +573,26 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -590,25 +603,26 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -619,25 +633,26 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -651,33 +666,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -690,25 +705,26 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-07-01" + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -722,41 +738,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-07-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -795,6 +811,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -806,6 +824,7 @@ def prepare_request(next_link=None): 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) @@ -816,6 +835,7 @@ def prepare_request(next_link=None): 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) @@ -833,7 +853,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]: @@ -846,7 +870,7 @@ def get_next(next_link=None): 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, @@ -861,6 +885,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -869,6 +894,7 @@ def _capture_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'], @@ -876,7 +902,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -892,7 +922,7 @@ def _capture_initial( 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 @@ -926,8 +956,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -939,6 +970,7 @@ 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 @@ -963,10 +995,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -981,6 +1012,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -989,6 +1021,7 @@ def _create_or_update_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'], @@ -996,7 +1029,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1014,7 +1051,7 @@ def _create_or_update_initial( 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 @@ -1047,8 +1084,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1060,6 +1098,7 @@ 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 @@ -1084,10 +1123,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1102,6 +1140,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1110,6 +1149,7 @@ def _update_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'], @@ -1117,7 +1157,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1135,7 +1179,7 @@ def _update_initial( 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 @@ -1167,8 +1211,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1180,6 +1225,7 @@ 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 @@ -1204,12 +1250,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1221,17 +1266,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1241,11 +1293,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1269,7 +1321,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1280,6 +1333,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1300,10 +1354,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1319,8 +1372,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1333,18 +1386,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -1358,7 +1418,7 @@ def get( 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 @@ -1385,17 +1445,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -1409,10 +1476,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1424,17 +1491,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1444,11 +1518,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1477,7 +1551,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1488,6 +1563,7 @@ 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 ) @@ -1508,12 +1584,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1525,17 +1600,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1545,11 +1627,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1574,7 +1656,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1585,6 +1668,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1605,13 +1689,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1639,17 +1722,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -1659,7 +1749,7 @@ 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 @@ -1680,6 +1770,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1691,6 +1783,7 @@ def prepare_request(next_link=None): 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) @@ -1701,6 +1794,7 @@ def prepare_request(next_link=None): 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) @@ -1718,7 +1812,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]: @@ -1731,7 +1829,7 @@ def get_next(next_link=None): 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( @@ -1743,7 +1841,7 @@ 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 @@ -1752,6 +1850,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1762,6 +1862,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1772,6 +1873,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1790,7 +1892,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]: @@ -1803,7 +1909,7 @@ def get_next(next_link=None): 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( @@ -1826,6 +1932,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_07_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1838,6 +1946,7 @@ def prepare_request(next_link=None): 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) @@ -1849,6 +1958,7 @@ def prepare_request(next_link=None): 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) @@ -1866,7 +1976,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]: @@ -1879,9 +1993,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -1894,18 +2008,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -1915,11 +2036,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1935,7 +2056,7 @@ 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. @@ -1949,7 +2070,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -1961,6 +2083,7 @@ 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 ) @@ -1981,12 +2104,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1998,17 +2120,24 @@ def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: 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) - 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]: @@ -2018,11 +2147,11 @@ 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 @distributed_trace - def begin_reapply( + def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2046,7 +2175,8 @@ def begin_reapply( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -2057,6 +2187,7 @@ 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 ) @@ -2077,12 +2208,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2094,17 +2224,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -2114,11 +2251,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2142,7 +2279,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -2153,6 +2291,7 @@ 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 ) @@ -2173,12 +2312,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2190,17 +2328,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -2210,11 +2355,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2238,7 +2383,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -2249,6 +2395,7 @@ 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 ) @@ -2269,12 +2416,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2286,17 +2432,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -2306,11 +2459,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2334,7 +2487,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -2345,6 +2499,7 @@ 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 ) @@ -2365,12 +2520,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2383,6 +2537,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -2394,6 +2549,7 @@ def _reimage_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'], @@ -2401,7 +2557,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2411,11 +2571,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2428,7 +2588,8 @@ 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.v2019_07_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2442,8 +2603,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2455,6 +2617,7 @@ 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 @@ -2476,12 +2639,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2493,17 +2655,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-07-01") # type: str + 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) - 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]: @@ -2513,11 +2682,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2542,7 +2711,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -2553,6 +2723,7 @@ 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 ) @@ -2573,16 +2744,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore def _run_command_initial( self, resource_group_name: 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"]] @@ -2591,7 +2763,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-07-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2599,6 +2771,7 @@ def _run_command_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'], @@ -2606,7 +2779,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2622,7 +2799,7 @@ def _run_command_initial( 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 @@ -2631,6 +2808,8 @@ def begin_run_command( 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. @@ -2641,6 +2820,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_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 @@ -2654,8 +2836,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_07_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-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( 'polling_interval', @@ -2668,6 +2850,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2691,7 +2874,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_compute_management_client.py index 77e6d44c25a5..de57ce87e0ff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -36,8 +37,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-11-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. """ @@ -63,7 +67,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_configuration.py index 06d9c16ac2cc..a7ff8012fcf6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2019-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-11-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_metadata.json index 7f9e6b11edac..3f1f66e9de6a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_compute_management_client.py index 692b026fc28c..21133a5b1f0c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -36,8 +37,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-11-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_configuration.py index b1f2b0975a96..3153fc96e0d1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/_configuration.py @@ -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 "2019-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-11-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disk_encryption_sets_operations.py index b8dcd8ecbce6..17b531bccf3f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -130,8 +135,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -167,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -193,6 +200,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,7 +230,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -254,8 +266,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,6 +280,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -291,10 +305,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async async def get( @@ -322,17 +335,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -346,10 +366,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -361,17 +381,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -381,11 +408,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -411,7 +438,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -422,6 +450,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -442,10 +471,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -464,6 +492,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -475,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -485,6 +516,7 @@ def prepare_request(next_link=None): 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) @@ -502,7 +534,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]: @@ -515,7 +551,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -531,6 +567,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -541,6 +579,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -550,6 +589,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -567,7 +607,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]: @@ -580,4 +624,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disks_operations.py index fd1c8c56e33f..49f7c451be1a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_snapshots_operations.py index 5a4a701427f8..a91e934ae5f7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_11_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_11_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disk_encryption_sets_operations.py index 007111f67761..f7798b213813 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -285,6 +289,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -293,6 +298,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -300,7 +306,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -318,7 +328,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -353,8 +363,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -366,6 +377,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -390,10 +402,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore def _update_initial( self, @@ -408,6 +419,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -416,6 +428,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -423,7 +436,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -441,7 +458,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -476,8 +493,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -489,6 +507,7 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -513,10 +532,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def get( @@ -544,17 +562,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -568,10 +593,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -583,17 +608,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -603,11 +635,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -633,7 +665,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -644,6 +677,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -664,10 +698,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -686,6 +719,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -697,6 +732,7 @@ def prepare_request(next_link=None): 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) @@ -707,6 +743,7 @@ def prepare_request(next_link=None): 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) @@ -724,7 +761,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]: @@ -737,7 +778,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -753,6 +794,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -763,6 +806,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -772,6 +816,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -789,7 +834,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]: @@ -802,4 +851,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disks_operations.py index 73c55c9984fb..a727787de839 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_11_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_snapshots_operations.py index 985f53b5bbd5..cbf06ebe8713 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_11_01/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-11-01" + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_11_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_11_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_11_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py index d62a1658959c..fa76541f1513 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -98,8 +99,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-12-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. """ @@ -147,7 +151,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_configuration.py index 38e6844950d7..97d53e452ed3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2019-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-12-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json index 8a6d3ec547b6..864392463fa6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py index 53001d03dc97..32836626fa02 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -100,8 +101,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2019-12-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_configuration.py index a8608081381a..7b931d3eb463 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/_configuration.py @@ -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 "2019-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2019-12-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_availability_sets_operations.py index 8052afa37a51..2d5096f54038 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_host_groups_operations.py index c73f1bf4c927..5a0707fb568b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -138,6 +143,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -146,6 +152,7 @@ async def update( 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'], @@ -153,7 +160,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -167,11 +178,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -194,17 +205,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -214,7 +232,7 @@ 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 @@ -241,17 +259,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -265,7 +290,7 @@ async def get( 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 @@ -286,6 +311,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -297,6 +324,7 @@ def prepare_request(next_link=None): 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) @@ -307,6 +335,7 @@ def prepare_request(next_link=None): 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) @@ -324,7 +353,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]: @@ -337,7 +370,7 @@ async def get_next(next_link=None): 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( @@ -354,6 +387,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +399,7 @@ def prepare_request(next_link=None): 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) @@ -373,6 +409,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -390,7 +427,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]: @@ -403,4 +444,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_hosts_operations.py index c1104f070349..8299b3db050d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -255,8 +267,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,6 +282,7 @@ 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 @@ -293,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -311,18 +324,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -332,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -363,7 +383,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -375,6 +396,7 @@ 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 ) @@ -395,10 +417,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace_async async def get( @@ -417,8 +438,8 @@ async def get( :type host_group_name: str :param host_name: The name of the dedicated host. :type host_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -431,19 +452,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -457,7 +485,7 @@ async def get( 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 @@ -481,6 +509,8 @@ def list_by_host_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -493,6 +523,7 @@ def prepare_request(next_link=None): 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) @@ -504,6 +535,7 @@ def prepare_request(next_link=None): 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) @@ -521,7 +553,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]: @@ -534,4 +570,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_galleries_operations.py index a797502613b0..060500305d8d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -97,7 +102,7 @@ async def _create_or_update_initial( 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 @@ -130,8 +135,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ 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 @@ -167,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'GalleryUpdate') @@ -193,6 +200,7 @@ async def _update_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'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -214,7 +226,7 @@ async def _update_initial( 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 @@ -247,8 +259,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -260,6 +273,7 @@ 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 @@ -284,10 +298,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace_async async def get( @@ -313,17 +326,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -337,10 +357,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -352,17 +372,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -372,11 +399,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -400,7 +427,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -411,6 +439,7 @@ 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 ) @@ -431,10 +460,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -452,6 +480,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -463,6 +493,7 @@ def prepare_request(next_link=None): 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) @@ -473,6 +504,7 @@ def prepare_request(next_link=None): 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) @@ -490,7 +522,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]: @@ -503,7 +539,7 @@ async def get_next(next_link=None): 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( @@ -518,6 +554,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -528,6 +566,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -537,6 +576,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -554,7 +594,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,4 +611,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_application_versions_operations.py index b1bb31d3ac15..2404f24e7dff 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -147,8 +152,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -162,6 +168,7 @@ 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 @@ -186,10 +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) + 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 + 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, @@ -206,6 +212,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') @@ -216,6 +223,7 @@ async def _update_initial( 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'], @@ -223,7 +231,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -237,7 +249,7 @@ async def _update_initial( 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 @@ -283,8 +295,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -298,6 +311,7 @@ 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 @@ -322,10 +336,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) + 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 + 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( @@ -350,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.v2019_12_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) @@ -363,6 +376,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -370,13 +385,18 @@ async def get( 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) - 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]: @@ -390,10 +410,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -407,6 +427,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -414,12 +436,17 @@ async def _delete_initial( 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) - 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]: @@ -429,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -466,7 +493,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +507,7 @@ 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 ) @@ -499,10 +528,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) + 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 + 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( @@ -529,6 +557,8 @@ def list_by_gallery_application( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -542,6 +572,7 @@ def prepare_request(next_link=None): 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) @@ -554,6 +585,7 @@ def prepare_request(next_link=None): 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) @@ -571,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]: @@ -584,4 +620,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_applications_operations.py index f266243c9941..0536d04791cf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplication') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -139,8 +144,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -153,6 +159,7 @@ 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 @@ -177,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore async def _update_initial( self, @@ -196,6 +202,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') @@ -205,6 +212,7 @@ async def _update_initial( 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'], @@ -212,7 +220,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -265,8 +277,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,6 +292,7 @@ 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 @@ -303,10 +317,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace_async async def get( @@ -337,18 +350,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, + 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(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]: @@ -362,10 +382,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -378,18 +398,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -399,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -431,7 +458,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,6 +471,7 @@ 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 ) @@ -463,10 +492,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -489,6 +517,8 @@ def list_by_gallery( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -501,6 +531,7 @@ def prepare_request(next_link=None): 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) @@ -512,6 +543,7 @@ def prepare_request(next_link=None): 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) @@ -529,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]: @@ -542,4 +578,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_image_versions_operations.py index f13733497f74..375e19141b06 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -146,8 +151,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -161,6 +167,7 @@ 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 @@ -185,10 +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) + 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 + 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, @@ -205,6 +211,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') @@ -215,6 +222,7 @@ async def _update_initial( 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'], @@ -222,7 +230,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -236,7 +248,7 @@ async def _update_initial( 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 @@ -281,8 +293,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,6 +309,7 @@ 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 @@ -320,10 +334,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) + 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 + 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( @@ -347,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.v2019_12_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) @@ -360,6 +373,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -367,13 +382,18 @@ async def get( 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) - 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]: @@ -387,10 +407,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -404,6 +424,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -411,12 +433,17 @@ async def _delete_initial( 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) - 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]: @@ -426,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -462,7 +489,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -475,6 +503,7 @@ 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 ) @@ -495,10 +524,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) + 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 + 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( @@ -525,6 +553,8 @@ def list_by_gallery_image( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -538,6 +568,7 @@ def prepare_request(next_link=None): 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) @@ -550,6 +581,7 @@ def prepare_request(next_link=None): 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) @@ -567,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]: @@ -580,4 +616,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_images_operations.py index 53952314a7aa..0da6ac4b57ca 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,6 +157,7 @@ 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 @@ -175,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore async def _update_initial( self, @@ -194,6 +200,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') @@ -203,6 +210,7 @@ async def _update_initial( 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'], @@ -210,7 +218,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -224,7 +236,7 @@ async def _update_initial( 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 @@ -262,8 +274,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,6 +289,7 @@ 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 @@ -300,10 +314,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace_async async def get( @@ -333,18 +346,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, + 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(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]: @@ -358,10 +378,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -374,18 +394,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -395,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -427,7 +454,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -439,6 +467,7 @@ 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 ) @@ -459,10 +488,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -484,6 +512,8 @@ def list_by_gallery( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -496,6 +526,7 @@ def prepare_request(next_link=None): 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) @@ -507,6 +538,7 @@ def prepare_request(next_link=None): 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) @@ -524,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]: @@ -537,4 +573,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_images_operations.py index 99ce67b98a64..6a801a4f4746 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_log_analytics_operations.py index b4d8657cae6f..9881f989f5e7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py index 8f7b6aa78d45..6daad53f0e91 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_proximity_placement_groups_operations.py index 489dc1eaa1b1..d31afd72dabf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -230,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) @@ -243,18 +261,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -268,7 +293,7 @@ async def get( 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 @@ -285,6 +310,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -295,6 +322,7 @@ def prepare_request(next_link=None): 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) @@ -304,6 +332,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -321,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]: @@ -334,7 +367,7 @@ async def get_next(next_link=None): 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( @@ -353,6 +386,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +399,7 @@ def prepare_request(next_link=None): 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) @@ -374,6 +410,7 @@ def prepare_request(next_link=None): 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) @@ -391,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]: @@ -404,4 +445,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_ssh_public_keys_operations.py index bed49ab47cfb..9e4bcd7a75b8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -71,6 +72,7 @@ def prepare_request(next_link=None): 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) @@ -80,6 +82,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -97,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]: @@ -110,7 +117,7 @@ async def get_next(next_link=None): 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( @@ -130,6 +137,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -141,6 +150,7 @@ def prepare_request(next_link=None): 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) @@ -151,6 +161,7 @@ def prepare_request(next_link=None): 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) @@ -168,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]: @@ -181,7 +196,7 @@ async def get_next(next_link=None): 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( @@ -210,6 +225,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -218,6 +234,7 @@ async def create( 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'], @@ -225,7 +242,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -243,7 +264,7 @@ async def create( 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 @@ -273,6 +294,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -281,6 +303,7 @@ async def update( 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'], @@ -288,7 +311,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +329,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -329,17 +356,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -349,7 +383,7 @@ 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 @@ -376,17 +410,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -400,7 +441,7 @@ async def get( 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 @@ -429,17 +470,24 @@ async def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -453,5 +501,5 @@ async def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_usage_operations.py index 40ec5d2d89f9..830b64c1d1a8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extension_images_operations.py index f1e76ed124c7..234987290ffa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extensions_operations.py index 30bd01057a8e..4001e52c4bd4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_images_operations.py index 0f2952bb6f30..97771cecce63 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_run_commands_operations.py index f5ce93851d4b..247e0a3679af 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,7 +121,7 @@ async def get_next(next_link=None): 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( @@ -140,17 +147,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -164,5 +178,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 4dc54bac5426..9a1d0ccc2408 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore async def _update_initial( self, @@ -192,6 +198,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -201,6 +208,7 @@ async def _update_initial( 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'], @@ -208,7 +216,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -264,8 +276,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,6 +291,7 @@ 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 @@ -302,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -320,18 +333,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -341,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -372,7 +392,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -384,6 +405,7 @@ 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 ) @@ -404,10 +426,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -426,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) @@ -439,19 +460,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -465,7 +493,7 @@ async def get( 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 @@ -488,6 +516,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -500,6 +530,7 @@ def prepare_request(next_link=None): 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) @@ -511,6 +542,7 @@ def prepare_request(next_link=None): 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) @@ -528,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]: @@ -541,4 +577,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 27962f35b1bc..831d1ba30672 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,12 +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) + 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 + 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, @@ -252,17 +267,24 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -272,11 +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 @distributed_trace_async - async def begin_start_extension_upgrade( + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -302,7 +324,8 @@ async def begin_start_extension_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,6 +336,7 @@ 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 ) @@ -333,10 +357,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) + 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 + 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( @@ -362,17 +385,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -386,5 +416,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 20c057c70624..36c561044b7d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -136,8 +141,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,6 +157,7 @@ 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 @@ -175,10 +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) + 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 + 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, @@ -195,6 +201,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -205,6 +212,7 @@ async def _update_initial( 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'], @@ -212,7 +220,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -267,8 +279,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -282,6 +295,7 @@ 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 @@ -306,12 +320,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) + 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 + 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, @@ -325,6 +338,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -332,12 +347,17 @@ async def _delete_initial( 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) - 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]: @@ -347,11 +367,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -381,7 +401,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -394,6 +415,7 @@ 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 ) @@ -414,10 +436,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) + 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 + 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( @@ -439,7 +460,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: VirtualMachineExtension, or the result of cls(response) @@ -452,6 +473,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -459,13 +482,18 @@ async def get( 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) - 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]: @@ -479,7 +507,7 @@ async def get( 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 @@ -499,7 +527,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: VirtualMachineExtensionsListResult, or the result of cls(response) @@ -512,19 +540,26 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -538,5 +573,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index e444817f99d0..934875c92f3a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -62,6 +61,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -74,6 +74,7 @@ async def _reimage_initial( 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'], @@ -81,7 +82,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -112,6 +117,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -126,8 +132,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +147,7 @@ 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 @@ -161,12 +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) + 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 + 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, @@ -179,18 +186,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -200,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -232,7 +246,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -244,6 +259,7 @@ 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 ) @@ -264,12 +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) + 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 + 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, @@ -282,18 +297,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -303,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,7 +358,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -348,6 +371,7 @@ 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 ) @@ -368,10 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -387,6 +410,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -396,6 +420,7 @@ async def _update_initial( 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'], @@ -403,7 +428,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -421,7 +450,7 @@ async def _update_initial( 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 @@ -458,8 +487,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +502,7 @@ 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 @@ -496,12 +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) + 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 + 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, @@ -514,18 +544,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -535,11 +572,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -566,7 +603,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -578,6 +616,7 @@ async def begin_delete( 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 ) @@ -598,10 +637,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -620,8 +658,8 @@ async def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. :type instance_id: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -634,19 +672,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -660,7 +705,7 @@ async def get( 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 @@ -690,18 +735,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -715,7 +767,7 @@ async def get_instance_view( 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 @@ -736,12 +788,13 @@ 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 @@ -750,6 +803,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -762,6 +817,7 @@ def prepare_request(next_link=None): 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, @@ -776,6 +832,7 @@ def prepare_request(next_link=None): 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, @@ -796,7 +853,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]: @@ -809,9 +870,9 @@ async def get_next(next_link=None): 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, @@ -825,19 +886,26 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -847,11 +915,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -871,7 +939,7 @@ 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. @@ -885,7 +953,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -898,6 +967,7 @@ 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 ) @@ -918,12 +988,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -936,18 +1005,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -957,11 +1033,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -988,7 +1064,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1000,6 +1077,7 @@ 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 ) @@ -1020,12 +1098,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1038,18 +1115,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1059,11 +1143,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1090,7 +1174,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1102,6 +1187,7 @@ 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 ) @@ -1122,12 +1208,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1140,18 +1225,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1161,11 +1253,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1193,7 +1285,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1205,6 +1298,7 @@ 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 ) @@ -1225,12 +1319,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1243,18 +1336,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1264,11 +1364,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1296,7 +1396,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1308,6 +1409,7 @@ 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 ) @@ -1328,13 +1430,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1361,18 +1462,25 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -1382,7 +1490,7 @@ 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( @@ -1391,6 +1499,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"]] @@ -1399,7 +1509,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1408,6 +1518,7 @@ async def _run_command_initial( 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'], @@ -1415,7 +1526,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1431,7 +1546,7 @@ async def _run_command_initial( 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 @@ -1441,6 +1556,8 @@ async def begin_run_command( 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. @@ -1453,6 +1570,9 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_12_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 @@ -1467,8 +1587,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-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( 'polling_interval', @@ -1482,6 +1602,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1505,7 +1626,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_sets_operations.py index eba08abcb4e2..2d3e4030eb4d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -190,6 +197,7 @@ async def _update_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'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -211,7 +223,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -318,11 +338,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -406,17 +427,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,10 +458,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -446,6 +474,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -457,6 +486,7 @@ async def _deallocate_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'], @@ -464,7 +494,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -474,11 +508,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -493,7 +527,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -508,8 +543,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,6 +557,7 @@ 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 @@ -542,12 +579,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) + 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 + 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, @@ -560,6 +596,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -568,6 +605,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -575,7 +613,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -585,11 +627,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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -617,8 +659,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -630,6 +673,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -651,10 +695,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) + 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 + 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( @@ -680,17 +723,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -704,7 +754,7 @@ async def get_instance_view( 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 @@ -724,6 +774,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -735,6 +787,7 @@ def prepare_request(next_link=None): 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) @@ -745,6 +798,7 @@ def prepare_request(next_link=None): 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) @@ -762,7 +816,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]: @@ -775,7 +833,7 @@ async def get_next(next_link=None): 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( @@ -793,6 +851,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -803,6 +863,7 @@ def prepare_request(next_link=None): 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) @@ -812,6 +873,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -829,7 +891,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]: @@ -842,7 +908,7 @@ async def get_next(next_link=None): 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( @@ -865,6 +931,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -877,6 +945,7 @@ def prepare_request(next_link=None): 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) @@ -888,6 +957,7 @@ def prepare_request(next_link=None): 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) @@ -905,7 +975,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]: @@ -918,7 +992,7 @@ async def get_next(next_link=None): 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( @@ -940,6 +1014,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -952,6 +1028,7 @@ def prepare_request(next_link=None): 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) @@ -963,6 +1040,7 @@ def prepare_request(next_link=None): 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) @@ -980,7 +1058,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]: @@ -993,9 +1075,9 @@ async def get_next(next_link=None): 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, @@ -1009,6 +1091,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1020,6 +1103,7 @@ async def _power_off_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, @@ -1028,7 +1112,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1038,11 +1126,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1060,9 +1148,10 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1077,8 +1166,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1091,6 +1181,7 @@ 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 @@ -1112,12 +1203,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) + 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 + 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, @@ -1130,6 +1220,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1141,6 +1232,7 @@ async def _restart_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'], @@ -1148,7 +1240,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1158,11 +1254,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1175,7 +1271,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1190,8 +1287,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1203,6 +1301,7 @@ 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 @@ -1224,12 +1323,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) + 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 + 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, @@ -1242,6 +1340,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1253,6 +1352,7 @@ async def _start_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'], @@ -1260,7 +1360,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +1374,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1287,7 +1391,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1302,8 +1407,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1315,6 +1421,7 @@ 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 @@ -1336,12 +1443,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) + 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 + 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, @@ -1354,6 +1460,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1365,6 +1472,7 @@ async def _redeploy_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'], @@ -1372,7 +1480,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1382,11 +1494,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1400,7 +1512,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1415,8 +1528,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1428,6 +1542,7 @@ 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 @@ -1449,12 +1564,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1467,6 +1581,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1478,6 +1593,7 @@ async def _perform_maintenance_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'], @@ -1485,7 +1601,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1495,11 +1615,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1515,7 +1635,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1530,8 +1651,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1543,6 +1665,7 @@ 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 @@ -1564,12 +1687,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1582,6 +1704,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1590,6 +1713,7 @@ async def _update_instances_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'], @@ -1597,7 +1721,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1607,11 +1735,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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1639,8 +1767,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1652,6 +1781,7 @@ 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 @@ -1673,12 +1803,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) + 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 + 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, @@ -1691,6 +1820,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -1702,6 +1832,7 @@ async def _reimage_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'], @@ -1709,7 +1840,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1719,11 +1854,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1738,7 +1873,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -1753,8 +1888,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1766,6 +1902,7 @@ 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 @@ -1787,12 +1924,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1805,6 +1941,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1816,6 +1953,7 @@ async def _reimage_all_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'], @@ -1823,7 +1961,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1833,11 +1975,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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1851,7 +1993,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1866,8 +2009,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1879,6 +2023,7 @@ 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 @@ -1900,10 +2045,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) + 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 + 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( @@ -1934,18 +2078,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -1959,11 +2110,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + async def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1990,6 +2141,7 @@ async def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -1998,6 +2150,7 @@ async def convert_to_single_placement_group( 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'], @@ -2005,7 +2158,11 @@ async def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2015,10 +2172,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, @@ -2031,6 +2188,7 @@ async def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -2039,6 +2197,7 @@ async def _set_orchestration_service_state_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'], @@ -2046,7 +2205,11 @@ async def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2056,11 +2219,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 @distributed_trace_async - async def begin_set_orchestration_service_state( + async def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2087,8 +2250,9 @@ async def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2100,6 +2264,7 @@ 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 @@ -2121,7 +2286,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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_sizes_operations.py index 39a8ddfc2182..a90e3a498dca 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -64,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -85,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -102,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]: @@ -115,4 +121,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machines_operations.py index f363d43c1cd7..06834f039a1c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -318,8 +338,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,6 +352,7 @@ 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 @@ -355,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -373,6 +394,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -381,6 +403,7 @@ async def _update_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'], @@ -388,7 +411,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -406,7 +433,7 @@ async def _update_initial( 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 @@ -439,8 +466,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -452,6 +480,7 @@ 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 @@ -476,12 +505,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) + 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 + 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, @@ -493,17 +521,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -513,11 +548,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -541,7 +576,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +588,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -572,10 +609,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -591,8 +627,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -605,18 +641,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -630,7 +673,7 @@ async def get( 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 @@ -657,17 +700,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -681,10 +731,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -696,17 +746,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -716,11 +773,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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -749,7 +806,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -760,6 +818,7 @@ 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 ) @@ -780,12 +839,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) + 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 + 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, @@ -797,17 +855,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -817,11 +882,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -846,7 +911,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -857,6 +923,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -877,13 +944,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -911,17 +977,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -931,7 +1004,7 @@ 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 @@ -952,6 +1025,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -963,6 +1038,7 @@ def prepare_request(next_link=None): 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) @@ -973,6 +1049,7 @@ def prepare_request(next_link=None): 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) @@ -990,7 +1067,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]: @@ -1003,7 +1084,7 @@ async def get_next(next_link=None): 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( @@ -1015,7 +1096,7 @@ 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 @@ -1024,6 +1105,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1034,6 +1117,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1044,6 +1128,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1062,7 +1147,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,7 +1164,7 @@ async def get_next(next_link=None): 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( @@ -1098,6 +1187,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1110,6 +1201,7 @@ def prepare_request(next_link=None): 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) @@ -1121,6 +1213,7 @@ def prepare_request(next_link=None): 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) @@ -1138,7 +1231,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]: @@ -1151,9 +1248,9 @@ async def get_next(next_link=None): 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, @@ -1166,18 +1263,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -1187,11 +1291,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1207,7 +1311,7 @@ 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. @@ -1221,7 +1325,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1233,6 +1338,7 @@ 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 ) @@ -1253,12 +1359,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _reapply_initial( + async def _reapply_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1270,17 +1375,24 @@ async def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -1290,11 +1402,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 @distributed_trace_async - async def begin_reapply( + async def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1318,7 +1430,8 @@ async def begin_reapply( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1329,6 +1442,7 @@ 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 ) @@ -1349,12 +1463,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) + 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 + begin_reapply.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1366,17 +1479,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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,11 +1506,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1414,7 +1534,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1425,6 +1546,7 @@ 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 ) @@ -1445,12 +1567,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) + 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 + 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, @@ -1462,17 +1583,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -1482,11 +1610,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1510,7 +1638,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1521,6 +1650,7 @@ 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 ) @@ -1541,12 +1671,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) + 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 + 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, @@ -1558,17 +1687,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -1578,11 +1714,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1606,7 +1742,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1617,6 +1754,7 @@ 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 ) @@ -1637,12 +1775,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) + 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 + 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, @@ -1655,6 +1792,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1666,6 +1804,7 @@ async def _reimage_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'], @@ -1673,7 +1812,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1683,11 +1826,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1700,7 +1843,8 @@ 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.v2019_12_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1714,8 +1858,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1727,6 +1872,7 @@ 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 @@ -1748,12 +1894,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1765,17 +1910,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -1785,11 +1937,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1814,7 +1966,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1825,6 +1978,7 @@ 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 ) @@ -1845,13 +1999,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1875,17 +2028,24 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -1895,7 +2055,7 @@ 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 _run_command_initial( @@ -1903,6 +2063,8 @@ async def _run_command_initial( 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"]] @@ -1911,7 +2073,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1919,6 +2081,7 @@ async def _run_command_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'], @@ -1926,7 +2089,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1942,7 +2109,7 @@ async def _run_command_initial( 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 @@ -1951,6 +2118,8 @@ async def begin_run_command( 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. @@ -1961,6 +2130,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_12_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 @@ -1975,8 +2147,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2019_12_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2019-12-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( 'polling_interval', @@ -1989,6 +2161,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2012,7 +2185,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py index 9d130ec26227..6b83e4a2c725 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_compute_management_client_enums.py @@ -203,7 +203,6 @@ class OrchestrationServiceNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enu """ AUTOMATIC_REPAIRS = "AutomaticRepairs" - DUMMY_ORCHESTRATION_SERVICE_NAME = "DummyOrchestrationServiceName" class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py index 1dd9bf0e5069..1d03629165c0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/models/_models_py3.py @@ -4963,7 +4963,7 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceNames :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". @@ -4989,7 +4989,7 @@ def __init__( ): """ :keyword service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :paramtype service_name: str or ~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceNames :keyword action: Required. The action to be performed. Possible values include: "Resume", @@ -5007,8 +5007,7 @@ class OrchestrationServiceSummary(msrest.serialization.Model): 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". + :ivar service_name: The name of the service. Possible values include: "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2019_12_01.models.OrchestrationServiceNames :ivar service_state: The current state of the service. Possible values include: "NotRunning", "Running", "Suspended". diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_availability_sets_operations.py index af732d0f517f..ebeef587bc25 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -185,31 +187,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -253,31 +257,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,6 +335,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -338,6 +344,7 @@ def create_or_update( 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'], @@ -345,7 +352,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -359,7 +370,7 @@ def create_or_update( 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 @@ -389,6 +400,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -397,6 +409,7 @@ def update( 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'], @@ -404,7 +417,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +435,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -445,17 +462,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -465,7 +489,7 @@ 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 @@ -492,17 +516,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -516,7 +547,7 @@ def get( 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 @@ -528,7 +559,7 @@ 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 @@ -537,6 +568,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -547,6 +580,7 @@ def prepare_request(next_link=None): 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'], ) @@ -557,6 +591,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -575,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]: @@ -588,7 +627,7 @@ def get_next(next_link=None): 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( @@ -607,6 +646,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -618,6 +659,7 @@ def prepare_request(next_link=None): 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) @@ -628,6 +670,7 @@ def prepare_request(next_link=None): 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) @@ -645,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]: @@ -658,7 +705,7 @@ def get_next(next_link=None): 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( @@ -681,6 +728,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_host_groups_operations.py index 35b39d139f57..7a37a5662c36 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -184,30 +186,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -216,29 +219,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -293,6 +297,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -301,6 +306,7 @@ def create_or_update( 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'], @@ -308,7 +314,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -326,7 +336,7 @@ def create_or_update( 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 @@ -356,6 +366,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -364,6 +375,7 @@ def update( 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'], @@ -371,7 +383,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,11 +401,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -412,17 +428,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -432,7 +455,7 @@ 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 @@ -459,17 +482,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -483,7 +513,7 @@ def get( 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 @@ -504,6 +534,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -515,6 +547,7 @@ def prepare_request(next_link=None): 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) @@ -525,6 +558,7 @@ def prepare_request(next_link=None): 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) @@ -542,7 +576,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]: @@ -555,7 +593,7 @@ def get_next(next_link=None): 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( @@ -572,6 +610,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -582,6 +622,7 @@ def prepare_request(next_link=None): 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) @@ -591,6 +632,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -608,7 +650,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]: @@ -621,4 +667,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_hosts_operations.py index ea9394970173..f4cf236c5eb2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_by_host_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -332,8 +341,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -346,6 +356,7 @@ 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 @@ -370,10 +381,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore def _update_initial( self, @@ -389,6 +399,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -398,6 +409,7 @@ def _update_initial( 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'], @@ -405,7 +417,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,7 +435,7 @@ def _update_initial( 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 @@ -454,8 +470,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,6 +485,7 @@ 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 @@ -492,12 +510,11 @@ 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) + 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 + 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: str, host_group_name: str, @@ -510,18 +527,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -531,11 +555,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -562,7 +586,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -574,6 +599,7 @@ 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 ) @@ -594,10 +620,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace def get( @@ -616,8 +641,8 @@ def get( :type host_group_name: str :param host_name: The name of the dedicated host. :type host_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -630,19 +655,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -656,7 +688,7 @@ def get( 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 @@ -680,6 +712,8 @@ def list_by_host_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -692,6 +726,7 @@ def prepare_request(next_link=None): 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) @@ -703,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -720,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]: @@ -733,4 +773,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_galleries_operations.py index b1af75e83198..4ab07585af42 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -285,6 +289,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -293,6 +298,7 @@ def _create_or_update_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'], @@ -300,7 +306,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -321,7 +331,7 @@ def _create_or_update_initial( 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 @@ -353,8 +363,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -366,6 +377,7 @@ 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 @@ -390,10 +402,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore def _update_initial( self, @@ -408,6 +419,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'GalleryUpdate') @@ -416,6 +428,7 @@ def _update_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'], @@ -423,7 +436,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -437,7 +454,7 @@ def _update_initial( 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 @@ -469,8 +486,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -482,6 +500,7 @@ 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 @@ -506,10 +525,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def get( @@ -535,17 +553,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -559,10 +584,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -574,17 +599,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -594,11 +626,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -622,7 +654,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -633,6 +666,7 @@ 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 ) @@ -653,10 +687,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -673,6 +706,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -684,6 +719,7 @@ def prepare_request(next_link=None): 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) @@ -694,6 +730,7 @@ def prepare_request(next_link=None): 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) @@ -711,7 +748,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]: @@ -724,7 +765,7 @@ def get_next(next_link=None): 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( @@ -738,6 +779,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -748,6 +791,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -757,6 +801,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -774,7 +819,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]: @@ -787,4 +836,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_application_versions_operations.py index 376df6ca97cd..e3a8de0a1489 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -135,10 +135,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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}') + _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'), @@ -147,23 +148,23 @@ def build_get_request( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -176,10 +177,11 @@ def build_delete_request_initial( gallery_application_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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}') + _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'), @@ -188,21 +190,21 @@ def build_delete_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -214,10 +216,11 @@ def build_list_by_gallery_application_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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') + _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'), @@ -225,21 +228,21 @@ def build_list_by_gallery_application_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -280,6 +283,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') @@ -290,6 +294,7 @@ def _create_or_update_initial( 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'], @@ -297,7 +302,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -364,8 +373,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -379,6 +389,7 @@ 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 @@ -403,10 +414,9 @@ 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) + 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 + 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, @@ -423,6 +433,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') @@ -433,6 +444,7 @@ def _update_initial( 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'], @@ -440,7 +452,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -454,7 +470,7 @@ def _update_initial( 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 @@ -500,8 +516,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -515,6 +532,7 @@ 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 @@ -539,10 +557,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore @distributed_trace def get( @@ -567,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.v2019_12_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) @@ -580,6 +597,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -587,13 +606,18 @@ def get( 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) - 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]: @@ -607,10 +631,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -624,6 +648,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -631,12 +657,17 @@ def _delete_initial( 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) - 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]: @@ -646,11 +677,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -683,7 +714,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -696,6 +728,7 @@ 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 ) @@ -716,10 +749,9 @@ 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) + 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 + 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( @@ -746,6 +778,8 @@ def list_by_gallery_application( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -759,6 +793,7 @@ def prepare_request(next_link=None): 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) @@ -771,6 +806,7 @@ def prepare_request(next_link=None): 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) @@ -788,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]: @@ -801,4 +841,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_applications_operations.py index d3f28b1dc3ed..b96427e64f5e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_get_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -139,21 +140,21 @@ def build_get_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,10 +166,11 @@ def build_delete_request_initial( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -176,21 +178,21 @@ def build_delete_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -201,31 +203,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,6 +268,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplication') @@ -274,6 +278,7 @@ def _create_or_update_initial( 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'], @@ -281,7 +286,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -302,7 +311,7 @@ def _create_or_update_initial( 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 @@ -342,8 +351,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -356,6 +366,7 @@ 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 @@ -380,10 +391,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore def _update_initial( self, @@ -399,6 +409,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') @@ -408,6 +419,7 @@ def _update_initial( 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'], @@ -415,7 +427,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -429,7 +445,7 @@ def _update_initial( 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 @@ -468,8 +484,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -482,6 +499,7 @@ 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 @@ -506,10 +524,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def get( @@ -540,18 +557,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, + 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(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]: @@ -565,10 +589,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -581,18 +605,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -602,11 +633,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -634,7 +665,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -646,6 +678,7 @@ 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 ) @@ -666,10 +699,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -692,6 +724,8 @@ def list_by_gallery( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -704,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -715,6 +750,7 @@ def prepare_request(next_link=None): 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) @@ -732,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]: @@ -745,4 +785,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_image_versions_operations.py index 1c05a6ff4e38..55a801150d95 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -135,10 +135,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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}') + _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'), @@ -147,23 +148,23 @@ def build_get_request( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -176,10 +177,11 @@ def build_delete_request_initial( gallery_image_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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}') + _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'), @@ -188,21 +190,21 @@ def build_delete_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -214,10 +216,11 @@ def build_list_by_gallery_image_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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') + _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'), @@ -225,21 +228,21 @@ def build_list_by_gallery_image_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -280,6 +283,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -290,6 +294,7 @@ def _create_or_update_initial( 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'], @@ -297,7 +302,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -363,8 +372,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -378,6 +388,7 @@ 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 @@ -402,10 +413,9 @@ 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) + 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 + 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, @@ -422,6 +432,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') @@ -432,6 +443,7 @@ def _update_initial( 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'], @@ -439,7 +451,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -453,7 +469,7 @@ def _update_initial( 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 @@ -498,8 +514,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -513,6 +530,7 @@ 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 @@ -537,10 +555,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore @distributed_trace def get( @@ -564,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.v2019_12_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) @@ -577,6 +594,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -584,13 +603,18 @@ def get( 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) - 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]: @@ -604,10 +628,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -621,6 +645,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -628,12 +654,17 @@ def _delete_initial( 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) - 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]: @@ -643,11 +674,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -679,7 +710,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -692,6 +724,7 @@ 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 ) @@ -712,10 +745,9 @@ 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) + 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 + 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( @@ -742,6 +774,8 @@ def list_by_gallery_image( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -755,6 +789,7 @@ def prepare_request(next_link=None): 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) @@ -767,6 +802,7 @@ def prepare_request(next_link=None): 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) @@ -784,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]: @@ -797,4 +837,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_images_operations.py index fe0178474414..3e8cb4304b0d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_get_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -139,21 +140,21 @@ def build_get_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,10 +166,11 @@ def build_delete_request_initial( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -176,21 +178,21 @@ def build_delete_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -201,31 +203,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,6 +268,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -274,6 +278,7 @@ def _create_or_update_initial( 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'], @@ -281,7 +286,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -302,7 +311,7 @@ def _create_or_update_initial( 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 @@ -340,8 +349,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -354,6 +364,7 @@ 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 @@ -378,10 +389,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore def _update_initial( self, @@ -397,6 +407,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') @@ -406,6 +417,7 @@ def _update_initial( 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'], @@ -413,7 +425,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,10 +521,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def get( @@ -536,18 +553,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, + 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(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]: @@ -561,10 +585,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -577,18 +601,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -598,11 +629,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -630,7 +661,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -642,6 +674,7 @@ 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 ) @@ -662,10 +695,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -686,6 +718,8 @@ def list_by_gallery( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -698,6 +732,7 @@ def prepare_request(next_link=None): 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) @@ -709,6 +744,7 @@ def prepare_request(next_link=None): 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) @@ -726,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]: @@ -739,4 +779,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_images_operations.py index 95805e6ee49c..74af645c3e3f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -154,33 +155,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -291,6 +296,7 @@ def _create_or_update_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'], @@ -298,7 +304,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -316,7 +326,7 @@ def _create_or_update_initial( 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 @@ -347,8 +357,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -360,6 +371,7 @@ 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 @@ -384,10 +396,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -402,6 +413,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -410,6 +422,7 @@ def _update_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'], @@ -417,7 +430,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -435,7 +452,7 @@ def _update_initial( 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 @@ -466,8 +483,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +497,7 @@ 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 @@ -503,12 +522,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -520,17 +538,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -540,11 +565,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -568,7 +593,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,6 +605,7 @@ 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 ) @@ -599,10 +626,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -618,7 +644,7 @@ 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) @@ -631,18 +657,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -656,7 +689,7 @@ def get( 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 @@ -674,6 +707,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -685,6 +720,7 @@ def prepare_request(next_link=None): 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) @@ -695,6 +731,7 @@ def prepare_request(next_link=None): 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) @@ -712,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]: @@ -725,7 +766,7 @@ def get_next(next_link=None): 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( @@ -740,6 +781,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -750,6 +793,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -759,6 +803,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -776,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]: @@ -789,4 +838,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_log_analytics_operations.py index cfb237fc62bd..101c93dfdec9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py index b6904730a31b..fde8c8f2bcf7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_proximity_placement_groups_operations.py index eacb649cdd43..d6924d7ee9d8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( include_colocation_status: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -187,29 +189,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -295,6 +299,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -303,6 +308,7 @@ def create_or_update( 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'], @@ -310,7 +316,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -328,7 +338,7 @@ def create_or_update( 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 @@ -358,6 +368,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -366,6 +377,7 @@ def update( 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'], @@ -373,7 +385,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -387,11 +403,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -414,17 +430,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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,7 +457,7 @@ 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 @@ -452,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) @@ -465,18 +488,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -490,7 +520,7 @@ def get( 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 @@ -507,6 +537,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -517,6 +549,7 @@ def prepare_request(next_link=None): 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) @@ -526,6 +559,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -543,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]: @@ -556,7 +594,7 @@ def get_next(next_link=None): 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( @@ -575,6 +613,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -586,6 +626,7 @@ def prepare_request(next_link=None): 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) @@ -596,6 +637,7 @@ def prepare_request(next_link=None): 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) @@ -613,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]: @@ -626,4 +672,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_ssh_public_keys_operations.py index ef5b1adaa0f7..6c29f76a2d0e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,30 +64,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -100,35 +102,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -144,35 +146,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -185,25 +187,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -214,31 +217,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -249,31 +253,32 @@ def build_generate_key_pair_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -314,6 +319,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -324,6 +331,7 @@ def prepare_request(next_link=None): 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) @@ -333,6 +341,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -350,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]: @@ -363,7 +376,7 @@ def get_next(next_link=None): 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( @@ -383,6 +396,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -394,6 +409,7 @@ def prepare_request(next_link=None): 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) @@ -404,6 +420,7 @@ def prepare_request(next_link=None): 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) @@ -421,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]: @@ -434,7 +455,7 @@ def get_next(next_link=None): 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( @@ -463,6 +484,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -471,6 +493,7 @@ def create( 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'], @@ -478,7 +501,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def create( 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 @@ -526,6 +553,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -534,6 +562,7 @@ def update( 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'], @@ -541,7 +570,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -555,11 +588,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -582,17 +615,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -602,7 +642,7 @@ 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 @@ -629,17 +669,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -653,7 +700,7 @@ def get( 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 @@ -682,17 +729,24 @@ def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -706,5 +760,5 @@ def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_usage_operations.py index 75e17612989f..02a0c3486901 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extension_images_operations.py index 947d529cd9e4..497f521be962 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extensions_operations.py index 57338c5b029e..f301a40d42f4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,9 +127,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -137,16 +138,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -160,10 +161,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -171,23 +173,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -200,33 +202,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,6 +269,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -275,6 +279,7 @@ def _create_or_update_initial( 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'], @@ -282,7 +287,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -300,7 +309,7 @@ def _create_or_update_initial( 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 @@ -338,8 +347,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,6 +362,7 @@ 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 @@ -376,10 +387,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -395,6 +405,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -404,6 +415,7 @@ def _update_initial( 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'], @@ -411,7 +423,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -425,7 +441,7 @@ def _update_initial( 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 @@ -463,8 +479,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,6 +494,7 @@ 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 @@ -501,12 +519,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -519,18 +536,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -540,11 +564,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -571,7 +595,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -583,6 +608,7 @@ 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 ) @@ -603,10 +629,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -625,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) @@ -638,19 +663,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -664,7 +696,7 @@ def get( 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 @@ -681,7 +713,7 @@ 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) @@ -694,18 +726,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -719,5 +758,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_images_operations.py index 7136d0ff7538..c61ab4fb7a9c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_run_commands_operations.py index ec94e1ce7eff..036dbdf22db8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -65,31 +66,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -132,6 +134,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -143,6 +147,7 @@ def prepare_request(next_link=None): 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) @@ -153,6 +158,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -170,7 +176,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]: @@ -183,7 +193,7 @@ def get_next(next_link=None): 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( @@ -209,17 +219,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -233,5 +250,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_extensions_operations.py index f1f89da5e797..261de3054a96 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -336,8 +345,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -350,6 +360,7 @@ 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 @@ -374,10 +385,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore def _update_initial( self, @@ -393,6 +403,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -402,6 +413,7 @@ def _update_initial( 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'], @@ -409,7 +421,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,12 +521,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -521,18 +538,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -542,11 +566,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -573,7 +597,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -585,6 +610,7 @@ 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 ) @@ -605,10 +631,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -627,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) @@ -640,19 +665,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -666,7 +698,7 @@ def get( 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 @@ -689,6 +721,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -701,6 +735,7 @@ def prepare_request(next_link=None): 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) @@ -712,6 +747,7 @@ def prepare_request(next_link=None): 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) @@ -729,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]: @@ -742,4 +782,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 4204209dd426..e31658515ec6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,25 +33,26 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -62,25 +63,26 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -91,25 +93,26 @@ def build_start_extension_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -120,31 +123,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -170,7 +174,7 @@ 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: str, vm_scale_set_name: str, @@ -182,17 +186,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -202,11 +213,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -230,7 +241,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -241,6 +253,7 @@ 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 ) @@ -261,12 +274,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -278,17 +290,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,11 +317,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -328,7 +347,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -339,6 +359,7 @@ 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 ) @@ -359,12 +380,11 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def _start_extension_upgrade_initial( + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -376,17 +396,24 @@ def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -396,11 +423,11 @@ 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 @distributed_trace - def begin_start_extension_upgrade( + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -426,7 +453,8 @@ def begin_start_extension_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -437,6 +465,7 @@ 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 ) @@ -457,10 +486,9 @@ 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) + 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 + begin_start_extension_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -486,17 +514,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -510,5 +545,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 1d7156c1e3a9..f15de2bd668f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -53,23 +53,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -87,12 +87,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -101,23 +101,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -132,10 +132,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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}') + _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'), @@ -144,21 +145,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -173,10 +174,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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}') + _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'), @@ -185,23 +187,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,10 +217,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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') + _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'), @@ -226,23 +229,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +286,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -293,6 +297,7 @@ def _create_or_update_initial( 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'], @@ -300,7 +305,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -358,8 +367,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -373,6 +383,7 @@ 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 @@ -397,10 +408,9 @@ 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) + 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 + 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, @@ -417,6 +427,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -427,6 +438,7 @@ def _update_initial( 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'], @@ -434,7 +446,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -448,7 +464,7 @@ def _update_initial( 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 @@ -489,8 +505,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -504,6 +521,7 @@ 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 @@ -528,12 +546,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -547,6 +564,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -554,12 +573,17 @@ def _delete_initial( 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) - 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]: @@ -569,11 +593,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -603,7 +627,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -616,6 +641,7 @@ 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 ) @@ -636,10 +662,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -661,7 +686,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: VirtualMachineExtension, or the result of cls(response) @@ -674,6 +699,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -681,13 +708,18 @@ def get( 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) - 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]: @@ -701,7 +733,7 @@ def get( 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 @@ -721,7 +753,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: VirtualMachineExtensionsListResult, or the result of cls(response) @@ -734,19 +766,26 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -760,5 +799,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py index 07edfb0f8c4f..b298df2389ba 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,11 +39,11 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -51,22 +51,22 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,9 +80,10 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -90,16 +91,16 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -111,9 +112,10 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -121,16 +123,16 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -145,12 +147,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -158,23 +160,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -188,9 +190,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -198,16 +201,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -221,10 +224,11 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -232,23 +236,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -260,10 +264,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-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') + _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'), @@ -271,21 +276,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -300,37 +305,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -344,9 +350,10 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -354,18 +361,18 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -377,9 +384,10 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -387,16 +395,16 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -408,9 +416,10 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -418,16 +427,16 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -439,9 +448,10 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -449,16 +459,16 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -470,9 +480,10 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -480,16 +491,16 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -501,9 +512,10 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + _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'), @@ -511,16 +523,16 @@ def build_simulate_eviction_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -535,12 +547,12 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -548,29 +560,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -592,7 +604,7 @@ 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: str, vm_scale_set_name: str, @@ -606,6 +618,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -618,6 +631,7 @@ def _reimage_initial( 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'], @@ -625,7 +639,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -635,11 +653,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -656,6 +674,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -670,8 +689,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -684,6 +704,7 @@ 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 @@ -705,12 +726,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -723,18 +743,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -744,11 +771,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -776,7 +803,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -788,6 +816,7 @@ 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 ) @@ -808,12 +837,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -826,18 +854,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -847,11 +882,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -880,7 +915,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -892,6 +928,7 @@ 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 ) @@ -912,10 +949,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -931,6 +967,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -940,6 +977,7 @@ def _update_initial( 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'], @@ -947,7 +985,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -965,7 +1007,7 @@ def _update_initial( 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 @@ -1002,8 +1044,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -1016,6 +1059,7 @@ 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 @@ -1040,12 +1084,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1058,18 +1101,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1079,11 +1129,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1110,7 +1160,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1122,6 +1173,7 @@ def begin_delete( 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 ) @@ -1142,10 +1194,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1164,8 +1215,8 @@ def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. :type instance_id: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -1178,19 +1229,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -1204,7 +1262,7 @@ def get( 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 @@ -1234,18 +1292,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -1259,7 +1324,7 @@ def get_instance_view( 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 @@ -1280,12 +1345,13 @@ 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 @@ -1294,6 +1360,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1306,6 +1374,7 @@ def prepare_request(next_link=None): 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, @@ -1320,6 +1389,7 @@ def prepare_request(next_link=None): 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, @@ -1340,7 +1410,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]: @@ -1353,9 +1427,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1369,19 +1443,26 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-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) - 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]: @@ -1391,11 +1472,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1415,7 +1496,7 @@ 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. @@ -1429,7 +1510,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1442,6 +1524,7 @@ 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 ) @@ -1462,12 +1545,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1480,18 +1562,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1501,11 +1590,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1532,7 +1621,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1544,6 +1634,7 @@ 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 ) @@ -1564,12 +1655,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1582,18 +1672,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1603,11 +1700,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1634,7 +1731,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1646,6 +1744,7 @@ 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 ) @@ -1666,12 +1765,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1684,18 +1782,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1705,11 +1810,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1737,7 +1842,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1749,6 +1855,7 @@ 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 ) @@ -1769,12 +1876,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1787,18 +1893,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1808,11 +1921,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1840,7 +1953,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1852,6 +1966,7 @@ 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 ) @@ -1872,13 +1987,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1905,18 +2019,25 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -1926,7 +2047,7 @@ 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( @@ -1935,6 +2056,8 @@ 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"]] @@ -1943,7 +2066,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1952,6 +2075,7 @@ def _run_command_initial( 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'], @@ -1959,7 +2083,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1975,7 +2103,7 @@ def _run_command_initial( 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 @@ -1985,6 +2113,8 @@ def begin_run_command( 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. @@ -1997,6 +2127,9 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_12_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 @@ -2010,8 +2143,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-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( 'polling_interval', @@ -2025,6 +2158,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2048,7 +2182,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_sets_operations.py index 02c3d37f0a22..c253d123eda0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,31 +153,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,33 +192,33 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -232,33 +234,33 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -271,31 +273,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -305,30 +308,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -337,29 +341,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -370,31 +375,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -405,31 +411,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -444,35 +451,35 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -488,33 +495,33 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -530,33 +537,33 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -572,33 +579,33 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -614,33 +621,33 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -656,33 +663,33 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -698,33 +705,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -740,33 +747,33 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -781,32 +788,33 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -820,33 +828,33 @@ def build_convert_to_single_placement_group_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -862,39 +870,39 @@ def build_set_orchestration_service_state_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -929,6 +937,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -937,6 +946,7 @@ def _create_or_update_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'], @@ -944,7 +954,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -962,7 +976,7 @@ def _create_or_update_initial( 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 @@ -995,8 +1009,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1008,6 +1023,7 @@ 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 @@ -1032,10 +1048,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -1050,6 +1065,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -1058,6 +1074,7 @@ def _update_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'], @@ -1065,7 +1082,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1079,7 +1100,7 @@ def _update_initial( 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 @@ -1112,8 +1133,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1125,6 +1147,7 @@ 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 @@ -1149,12 +1172,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1166,17 +1188,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1186,11 +1215,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1214,7 +1243,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1225,6 +1255,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -1245,10 +1276,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1274,17 +1304,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1298,10 +1335,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1314,6 +1351,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1325,6 +1363,7 @@ def _deallocate_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'], @@ -1332,7 +1371,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1342,11 +1385,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1361,7 +1404,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1376,8 +1420,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1389,6 +1434,7 @@ 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 @@ -1410,12 +1456,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1428,6 +1473,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1436,6 +1482,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1443,7 +1490,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1453,11 +1504,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1485,8 +1536,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1498,6 +1550,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1519,10 +1572,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1548,17 +1600,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -1572,7 +1631,7 @@ def get_instance_view( 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 @@ -1592,6 +1651,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1603,6 +1664,7 @@ def prepare_request(next_link=None): 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) @@ -1613,6 +1675,7 @@ def prepare_request(next_link=None): 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) @@ -1630,7 +1693,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]: @@ -1643,7 +1710,7 @@ def get_next(next_link=None): 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( @@ -1661,6 +1728,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1671,6 +1740,7 @@ def prepare_request(next_link=None): 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) @@ -1680,6 +1750,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1697,7 +1768,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]: @@ -1710,7 +1785,7 @@ def get_next(next_link=None): 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( @@ -1733,6 +1808,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1745,6 +1822,7 @@ def prepare_request(next_link=None): 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) @@ -1756,6 +1834,7 @@ def prepare_request(next_link=None): 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) @@ -1773,7 +1852,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]: @@ -1786,7 +1869,7 @@ def get_next(next_link=None): 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( @@ -1808,6 +1891,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1820,6 +1905,7 @@ def prepare_request(next_link=None): 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) @@ -1831,6 +1917,7 @@ def prepare_request(next_link=None): 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) @@ -1848,7 +1935,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]: @@ -1861,9 +1952,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1877,6 +1968,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1888,6 +1980,7 @@ def _power_off_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, @@ -1896,7 +1989,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1906,11 +2003,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1928,9 +2025,10 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1945,8 +2043,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1959,6 +2058,7 @@ 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 @@ -1980,12 +2080,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1998,6 +2097,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2009,6 +2109,7 @@ def _restart_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'], @@ -2016,7 +2117,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2026,11 +2131,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2043,7 +2148,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2058,8 +2164,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2071,6 +2178,7 @@ 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 @@ -2092,12 +2200,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2110,6 +2217,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2121,6 +2229,7 @@ def _start_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'], @@ -2128,7 +2237,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2138,11 +2251,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2155,7 +2268,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2170,8 +2284,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2183,6 +2298,7 @@ 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 @@ -2204,12 +2320,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2222,6 +2337,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2233,6 +2349,7 @@ def _redeploy_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'], @@ -2240,7 +2357,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2250,11 +2371,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2268,7 +2389,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2283,8 +2405,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2296,6 +2419,7 @@ 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 @@ -2317,12 +2441,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2335,6 +2458,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2346,6 +2470,7 @@ def _perform_maintenance_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'], @@ -2353,7 +2478,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2363,11 +2492,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2383,7 +2512,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2398,8 +2528,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2411,6 +2542,7 @@ 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 @@ -2432,12 +2564,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2450,6 +2581,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2458,6 +2590,7 @@ def _update_instances_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'], @@ -2465,7 +2598,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2475,11 +2612,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2507,8 +2644,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2520,6 +2658,7 @@ 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 @@ -2541,12 +2680,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2559,6 +2697,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -2570,6 +2709,7 @@ def _reimage_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'], @@ -2577,7 +2717,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2587,11 +2731,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2606,7 +2750,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2019_12_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -2621,8 +2765,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2634,6 +2779,7 @@ 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 @@ -2655,12 +2801,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2673,6 +2818,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2684,6 +2830,7 @@ def _reimage_all_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'], @@ -2691,7 +2838,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2701,11 +2852,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2719,7 +2870,8 @@ 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. + :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.v2019_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2734,8 +2886,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2747,6 +2900,7 @@ 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 @@ -2768,10 +2922,9 @@ 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) + 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 + 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( @@ -2802,18 +2955,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -2827,11 +2987,11 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2858,6 +3018,7 @@ def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2866,6 +3027,7 @@ def convert_to_single_placement_group( 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'], @@ -2873,7 +3035,11 @@ def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2883,10 +3049,10 @@ 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: str, vm_scale_set_name: str, @@ -2899,6 +3065,7 @@ def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -2907,6 +3074,7 @@ def _set_orchestration_service_state_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'], @@ -2914,7 +3082,11 @@ def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2924,11 +3096,11 @@ 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 @distributed_trace - def begin_set_orchestration_service_state( + def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2955,8 +3127,9 @@ def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2968,6 +3141,7 @@ 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 @@ -2989,7 +3163,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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_sizes_operations.py index 70c91b33ccbe..e5b4d355ee10 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,6 +99,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -109,6 +112,7 @@ def prepare_request(next_link=None): 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) @@ -119,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py index 534ca80a8c93..e1714eed6022 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -200,25 +201,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -231,33 +233,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -268,31 +271,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -303,25 +307,26 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -332,25 +337,26 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -361,25 +367,26 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -389,30 +396,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -423,31 +431,32 @@ def build_list_all_request( status_only: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -458,31 +467,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -495,27 +505,28 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -526,31 +537,32 @@ def build_reapply_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -561,25 +573,26 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -590,25 +603,26 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -619,25 +633,26 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -651,33 +666,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -690,25 +705,26 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -719,25 +735,26 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2019-12-01" + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -751,41 +768,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2019-12-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -824,6 +841,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -835,6 +854,7 @@ def prepare_request(next_link=None): 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) @@ -845,6 +865,7 @@ def prepare_request(next_link=None): 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) @@ -862,7 +883,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]: @@ -875,7 +900,7 @@ def get_next(next_link=None): 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, @@ -890,6 +915,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -898,6 +924,7 @@ def _capture_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'], @@ -905,7 +932,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -921,7 +952,7 @@ def _capture_initial( 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 @@ -955,8 +986,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -968,6 +1000,7 @@ 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 @@ -992,10 +1025,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -1010,6 +1042,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -1018,6 +1051,7 @@ def _create_or_update_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'], @@ -1025,7 +1059,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1043,7 +1081,7 @@ def _create_or_update_initial( 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 @@ -1076,8 +1114,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1089,6 +1128,7 @@ 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 @@ -1113,10 +1153,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1131,6 +1170,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1139,6 +1179,7 @@ def _update_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'], @@ -1146,7 +1187,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1164,7 +1209,7 @@ def _update_initial( 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 @@ -1196,8 +1241,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1209,6 +1255,7 @@ 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 @@ -1233,12 +1280,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1250,17 +1296,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1270,11 +1323,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1298,7 +1351,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1309,6 +1363,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1329,10 +1384,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1348,8 +1402,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1362,18 +1416,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -1387,7 +1448,7 @@ def get( 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 @@ -1414,17 +1475,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -1438,10 +1506,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1453,17 +1521,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1473,11 +1548,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1506,7 +1581,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1517,6 +1593,7 @@ 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 ) @@ -1537,12 +1614,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1554,17 +1630,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1574,11 +1657,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1603,7 +1686,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1614,6 +1698,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1634,13 +1719,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1668,17 +1752,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -1688,7 +1779,7 @@ 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 @@ -1709,6 +1800,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1720,6 +1813,7 @@ def prepare_request(next_link=None): 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) @@ -1730,6 +1824,7 @@ def prepare_request(next_link=None): 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) @@ -1747,7 +1842,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]: @@ -1760,7 +1859,7 @@ def get_next(next_link=None): 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( @@ -1772,7 +1871,7 @@ 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 @@ -1781,6 +1880,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1791,6 +1892,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1801,6 +1903,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1819,7 +1922,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]: @@ -1832,7 +1939,7 @@ def get_next(next_link=None): 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( @@ -1855,6 +1962,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2019_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1867,6 +1976,7 @@ def prepare_request(next_link=None): 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) @@ -1878,6 +1988,7 @@ def prepare_request(next_link=None): 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) @@ -1895,7 +2006,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]: @@ -1908,9 +2023,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -1923,18 +2038,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -1944,11 +2066,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1964,7 +2086,7 @@ 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. @@ -1978,7 +2100,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1990,6 +2113,7 @@ 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 ) @@ -2010,12 +2134,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2027,17 +2150,24 @@ def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: 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) - 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]: @@ -2047,11 +2177,11 @@ 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 @distributed_trace - def begin_reapply( + def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2075,7 +2205,8 @@ def begin_reapply( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2086,6 +2217,7 @@ 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 ) @@ -2106,12 +2238,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2123,17 +2254,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -2143,11 +2281,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2171,7 +2309,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2182,6 +2321,7 @@ 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 ) @@ -2202,12 +2342,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2219,17 +2358,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -2239,11 +2385,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2267,7 +2413,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2278,6 +2425,7 @@ 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 ) @@ -2298,12 +2446,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2315,17 +2462,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -2335,11 +2489,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2363,7 +2517,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2374,6 +2529,7 @@ 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 ) @@ -2394,12 +2550,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2412,6 +2567,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -2423,6 +2579,7 @@ def _reimage_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'], @@ -2430,7 +2587,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2440,11 +2601,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2457,7 +2618,8 @@ 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.v2019_12_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2471,8 +2633,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2019-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2484,6 +2647,7 @@ 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 @@ -2505,12 +2669,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2522,17 +2685,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -2542,11 +2712,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2571,7 +2741,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2582,6 +2753,7 @@ 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 ) @@ -2602,13 +2774,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2632,17 +2803,24 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2019-12-01") # type: str + 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) - 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]: @@ -2652,7 +2830,7 @@ 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 _run_command_initial( @@ -2660,6 +2838,8 @@ def _run_command_initial( 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"]] @@ -2668,7 +2848,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2019-12-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2676,6 +2856,7 @@ def _run_command_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'], @@ -2683,7 +2864,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2699,7 +2884,7 @@ def _run_command_initial( 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 @@ -2708,6 +2893,8 @@ def begin_run_command( 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. @@ -2718,6 +2905,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2019_12_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 @@ -2731,8 +2921,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2019_12_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2019-12-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( 'polling_interval', @@ -2745,6 +2935,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2768,7 +2959,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py index 091c6301d598..d298df9c334c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -38,8 +39,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-05-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. """ @@ -66,7 +70,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_configuration.py index 019822c771dc..2e7aacb24f31 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2020-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-05-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json index d934bc9eea7d..b2a5b24423bb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py index ba1a1b9dc0e1..20a390566679 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -38,8 +39,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-05-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_configuration.py index 1bf67ffe0582..7c0314c35ffe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/_configuration.py @@ -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 "2020-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-05-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_accesses_operations.py index c6a067d4e006..ca416373840d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace_async async def get_private_link_resources( @@ -602,17 +646,24 @@ async def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -626,5 +677,5 @@ async def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_encryption_sets_operations.py index b3bd7f2fa394..ab8a50a983e7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -130,8 +135,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -167,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -193,6 +200,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,7 +230,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -254,8 +266,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,6 +280,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -291,10 +305,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async async def get( @@ -322,17 +335,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -346,10 +366,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -361,17 +381,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -381,11 +408,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -411,7 +438,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -422,6 +450,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -442,10 +471,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -464,6 +492,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -475,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -485,6 +516,7 @@ def prepare_request(next_link=None): 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) @@ -502,7 +534,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]: @@ -515,7 +551,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -531,6 +567,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -541,6 +579,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -550,6 +589,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -567,7 +607,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]: @@ -580,4 +624,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disks_operations.py index 69a607685412..c5ce393de0e7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_snapshots_operations.py index 2c946d7c0248..e6f52e3bfaef 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_05_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_05_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_accesses_operations.py index 67490c0ff217..ea2996804509 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_get_private_link_resources_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -320,6 +325,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -328,6 +334,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -335,7 +342,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -353,7 +364,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -386,8 +397,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -399,6 +411,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -423,10 +436,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore def _update_initial( self, @@ -441,6 +453,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -449,6 +462,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -456,7 +470,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -474,7 +492,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -507,8 +525,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -520,6 +539,7 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -544,10 +564,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def get( @@ -575,17 +594,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -599,10 +625,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -614,17 +640,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -634,11 +667,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -664,7 +697,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -675,6 +709,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -695,10 +730,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -715,6 +749,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -726,6 +762,7 @@ def prepare_request(next_link=None): 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) @@ -736,6 +773,7 @@ def prepare_request(next_link=None): 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) @@ -753,7 +791,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]: @@ -766,7 +808,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -780,6 +822,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -790,6 +834,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -799,6 +844,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -816,7 +862,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]: @@ -829,7 +879,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def get_private_link_resources( @@ -857,17 +907,24 @@ def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -881,5 +938,5 @@ def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_encryption_sets_operations.py index 73fb1e0e8ac4..0090a46302a9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -285,6 +289,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -293,6 +298,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -300,7 +306,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -318,7 +328,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -353,8 +363,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -366,6 +377,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -390,10 +402,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore def _update_initial( self, @@ -408,6 +419,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -416,6 +428,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -423,7 +436,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -441,7 +458,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -476,8 +493,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -489,6 +507,7 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -513,10 +532,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def get( @@ -544,17 +562,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -568,10 +593,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -583,17 +608,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -603,11 +635,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -633,7 +665,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -644,6 +677,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -664,10 +698,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -686,6 +719,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -697,6 +732,7 @@ def prepare_request(next_link=None): 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) @@ -707,6 +743,7 @@ def prepare_request(next_link=None): 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) @@ -724,7 +761,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]: @@ -737,7 +778,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -753,6 +794,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -763,6 +806,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -772,6 +816,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -789,7 +834,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]: @@ -802,4 +851,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disks_operations.py index cd2573cfb90b..e033bbf89729 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_snapshots_operations.py index b0a1c3e7b279..638b4e4b88a8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_05_01/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-05-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-05-01" + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_05_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_05_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py index 6590046874c0..b391ea021cdf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -89,8 +90,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-06-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. """ @@ -134,7 +138,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_configuration.py index a5016cfe8a08..14a011e4812f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2020-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-06-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json index 4a24723cd3b6..e1bf72da512f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py index 1bfeb019c55b..08e0e1778530 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -91,8 +92,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-06-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_configuration.py index 286912602f20..d4a6bed4dd38 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/_configuration.py @@ -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 "2020-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-06-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_availability_sets_operations.py index 7b18e72e4b28..b8559c13b347 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_host_groups_operations.py index 6b4375caa511..0f957207d0e1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -138,6 +143,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -146,6 +152,7 @@ async def update( 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'], @@ -153,7 +160,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -167,11 +178,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -194,17 +205,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -214,7 +232,7 @@ 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 @@ -232,8 +250,8 @@ async def get( :param host_group_name: The name of the dedicated host group. :type host_group_name: str :param expand: The expand expression to apply on the operation. The response shows the list of - instance view of the dedicated hosts under the dedicated host group. The default value is - "instanceView". + instance view of the dedicated hosts under the dedicated host group. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -246,18 +264,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -271,7 +296,7 @@ async def get( 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 @@ -292,6 +317,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -303,6 +330,7 @@ def prepare_request(next_link=None): 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) @@ -313,6 +341,7 @@ def prepare_request(next_link=None): 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) @@ -330,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]: @@ -343,7 +376,7 @@ async def get_next(next_link=None): 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( @@ -360,6 +393,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -370,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -379,6 +415,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -396,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]: @@ -409,4 +450,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_hosts_operations.py index f2c38f59e1ab..c02446112cb7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -255,8 +267,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,6 +282,7 @@ 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 @@ -293,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -311,18 +324,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -332,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -363,7 +383,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -375,6 +396,7 @@ 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 ) @@ -395,10 +417,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace_async async def get( @@ -417,8 +438,8 @@ async def get( :type host_group_name: str :param host_name: The name of the dedicated host. :type host_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -431,19 +452,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -457,7 +485,7 @@ async def get( 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 @@ -481,6 +509,8 @@ def list_by_host_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -493,6 +523,7 @@ def prepare_request(next_link=None): 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) @@ -504,6 +535,7 @@ def prepare_request(next_link=None): 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) @@ -521,7 +553,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]: @@ -534,4 +570,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_images_operations.py index 2a77cb693cce..2949f526196e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_log_analytics_operations.py index fe1bd21b7a4e..f4161577de4f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py index a5c63214fbd0..92c34629109c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_proximity_placement_groups_operations.py index d8ce0e9d9443..8d59e2cdd540 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -230,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) @@ -243,18 +261,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -268,7 +293,7 @@ async def get( 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 @@ -285,6 +310,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -295,6 +322,7 @@ def prepare_request(next_link=None): 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) @@ -304,6 +332,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -321,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]: @@ -334,7 +367,7 @@ async def get_next(next_link=None): 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( @@ -353,6 +386,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +399,7 @@ def prepare_request(next_link=None): 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) @@ -374,6 +410,7 @@ def prepare_request(next_link=None): 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) @@ -391,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]: @@ -404,4 +445,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_ssh_public_keys_operations.py index a65220cf696a..b839c9431548 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -71,6 +72,7 @@ def prepare_request(next_link=None): 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) @@ -80,6 +82,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -97,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]: @@ -110,7 +117,7 @@ async def get_next(next_link=None): 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( @@ -130,6 +137,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -141,6 +150,7 @@ def prepare_request(next_link=None): 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) @@ -151,6 +161,7 @@ def prepare_request(next_link=None): 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) @@ -168,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]: @@ -181,7 +196,7 @@ async def get_next(next_link=None): 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( @@ -210,6 +225,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -218,6 +234,7 @@ async def create( 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'], @@ -225,7 +242,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -243,7 +264,7 @@ async def create( 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 @@ -273,6 +294,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -281,6 +303,7 @@ async def update( 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'], @@ -288,7 +311,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +329,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -329,17 +356,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -349,7 +383,7 @@ 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 @@ -376,17 +410,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -400,7 +441,7 @@ async def get( 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 @@ -429,17 +470,24 @@ async def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -453,5 +501,5 @@ async def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_usage_operations.py index c6f651361eed..249bbfecb657 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extension_images_operations.py index dff891f122af..3d657d69fdb5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extensions_operations.py index 2bc414551586..dab3ebc1321c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_images_operations.py index 24dd2f7c1810..87fbb6a60bc1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_run_commands_operations.py index 9a2392caa2fc..bbc55b268824 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -65,6 +64,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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( @@ -142,17 +149,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -166,7 +180,7 @@ async def get( 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( @@ -175,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"] @@ -183,7 +199,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -192,6 +208,7 @@ async def _create_or_update_initial( 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'], @@ -199,7 +216,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -217,7 +238,7 @@ async def _create_or_update_initial( 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 @@ -227,6 +248,8 @@ async def begin_create_or_update( 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. @@ -240,6 +263,9 @@ 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.v2020_06_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 @@ -254,8 +280,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -269,6 +295,7 @@ async def begin_create_or_update( 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 ) @@ -292,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore async def _update_initial( self, @@ -303,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"] @@ -311,7 +339,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -320,6 +348,7 @@ async def _update_initial( 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'], @@ -327,7 +356,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,7 +374,7 @@ async def _update_initial( 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 @@ -351,6 +384,8 @@ async def begin_update( 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. @@ -363,6 +398,9 @@ 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.v2020_06_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 @@ -377,8 +415,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -392,6 +430,7 @@ async def begin_update( 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 ) @@ -415,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -433,18 +471,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -454,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -485,7 +530,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -497,6 +543,7 @@ 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 ) @@ -517,10 +564,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) + 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 + 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( @@ -539,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) @@ -552,19 +598,26 @@ async def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -578,7 +631,7 @@ async def get_by_virtual_machine( 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 @@ -595,7 +648,7 @@ 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 @@ -604,6 +657,8 @@ def list_by_virtual_machine( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -616,6 +671,7 @@ def prepare_request(next_link=None): 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'], ) @@ -628,6 +684,7 @@ def prepare_request(next_link=None): 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, ) @@ -646,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]: @@ -659,4 +720,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index e070b80ea23d..5960886d6061 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore async def _update_initial( self, @@ -192,6 +198,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -201,6 +208,7 @@ async def _update_initial( 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'], @@ -208,7 +216,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -264,8 +276,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,6 +291,7 @@ 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 @@ -302,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -320,18 +333,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -341,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -372,7 +392,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -384,6 +405,7 @@ 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 ) @@ -404,10 +426,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -426,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) @@ -439,19 +460,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -465,7 +493,7 @@ async def get( 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 @@ -488,6 +516,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -500,6 +530,7 @@ def prepare_request(next_link=None): 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) @@ -511,6 +542,7 @@ def prepare_request(next_link=None): 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) @@ -528,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]: @@ -541,4 +577,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 44120ab959b5..1565237a7ee0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,12 +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) + 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 + 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, @@ -252,17 +267,24 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -272,11 +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 @distributed_trace_async - async def begin_start_extension_upgrade( + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -302,7 +324,8 @@ async def begin_start_extension_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,6 +336,7 @@ 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 ) @@ -333,10 +357,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) + 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 + 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( @@ -362,17 +385,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -386,5 +416,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index d37ba8eca108..1ddc58f26c35 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -152,6 +158,7 @@ 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 @@ -176,10 +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) + 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 + 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, @@ -196,6 +202,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') @@ -206,6 +213,7 @@ async def _update_initial( 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'], @@ -213,7 +221,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +239,7 @@ async def _update_initial( 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 @@ -268,8 +280,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,6 +296,7 @@ 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 @@ -307,12 +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) + 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 + 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, @@ -326,6 +339,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -333,12 +348,17 @@ async def _delete_initial( 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) - 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]: @@ -348,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -382,7 +402,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,6 +416,7 @@ 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 ) @@ -415,10 +437,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) + 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 + 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( @@ -440,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) @@ -453,6 +474,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -460,13 +483,18 @@ async def get( 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) - 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]: @@ -480,7 +508,7 @@ async def get( 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 @@ -500,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) @@ -513,19 +541,26 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -539,5 +574,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index b2296d6068c5..632ebb32c7ac 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -55,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"] @@ -63,7 +64,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -73,6 +74,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +82,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -98,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -109,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. @@ -123,6 +131,9 @@ 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.v2020_06_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 @@ -137,8 +148,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -153,6 +164,7 @@ async def begin_create_or_update( 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 ) @@ -176,10 +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) + 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 + 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, @@ -188,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"] @@ -196,7 +209,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -206,6 +219,7 @@ async def _update_initial( 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'], @@ -213,7 +227,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +245,7 @@ async def _update_initial( 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 @@ -238,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. @@ -252,6 +272,9 @@ 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.v2020_06_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 @@ -266,8 +289,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -282,6 +305,7 @@ async def begin_update( 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 ) @@ -305,12 +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) + 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 + 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, @@ -324,6 +347,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -331,12 +356,17 @@ async def _delete_initial( 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) - 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]: @@ -346,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -380,7 +410,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,6 +424,7 @@ 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 ) @@ -413,10 +445,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) + 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 + 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( @@ -438,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) @@ -451,6 +482,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -458,13 +491,18 @@ async def get( 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) - 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]: @@ -478,7 +516,7 @@ async def get( 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 @@ -498,7 +536,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -507,6 +545,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -520,6 +560,7 @@ def prepare_request(next_link=None): 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'], ) @@ -533,6 +574,7 @@ def prepare_request(next_link=None): 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, ) @@ -551,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]: @@ -564,4 +610,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 1d583d0bae29..ce63dc663d6c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -62,6 +61,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -74,6 +74,7 @@ async def _reimage_initial( 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'], @@ -81,7 +82,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -112,6 +117,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -126,8 +132,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +147,7 @@ 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 @@ -161,12 +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) + 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 + 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, @@ -179,18 +186,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -200,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -232,7 +246,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -244,6 +259,7 @@ 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 ) @@ -264,12 +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) + 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 + 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, @@ -282,18 +297,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -303,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,7 +358,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -348,6 +371,7 @@ 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 ) @@ -368,10 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -387,6 +410,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -396,6 +420,7 @@ async def _update_initial( 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'], @@ -403,7 +428,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -421,7 +450,7 @@ async def _update_initial( 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 @@ -458,8 +487,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +502,7 @@ 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 @@ -496,12 +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) + 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 + 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, @@ -514,18 +544,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -535,11 +572,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -566,7 +603,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -578,6 +616,7 @@ async def begin_delete( 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 ) @@ -598,10 +637,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -620,8 +658,8 @@ async def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. :type instance_id: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -634,19 +672,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -660,7 +705,7 @@ async def get( 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 @@ -690,18 +735,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -715,7 +767,7 @@ async def get_instance_view( 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 @@ -736,12 +788,13 @@ 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 @@ -750,6 +803,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -762,6 +817,7 @@ def prepare_request(next_link=None): 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, @@ -776,6 +832,7 @@ def prepare_request(next_link=None): 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, @@ -796,7 +853,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]: @@ -809,9 +870,9 @@ async def get_next(next_link=None): 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, @@ -825,19 +886,26 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -847,11 +915,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -871,7 +939,7 @@ 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. @@ -885,7 +953,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -898,6 +967,7 @@ 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 ) @@ -918,12 +988,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -936,18 +1005,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -957,11 +1033,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -988,7 +1064,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1000,6 +1077,7 @@ 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 ) @@ -1020,12 +1098,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1038,18 +1115,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1059,11 +1143,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1090,7 +1174,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1102,6 +1187,7 @@ 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 ) @@ -1122,12 +1208,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1140,18 +1225,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1161,11 +1253,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1193,7 +1285,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1205,6 +1298,7 @@ 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 ) @@ -1225,10 +1319,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) + 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 + 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( @@ -1250,7 +1343,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) @@ -1263,19 +1356,26 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -1289,10 +1389,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + 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( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1305,18 +1405,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1326,11 +1433,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1357,7 +1464,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1369,6 +1477,7 @@ 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 ) @@ -1389,13 +1498,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1421,18 +1529,25 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -1442,7 +1557,7 @@ 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( @@ -1451,6 +1566,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"]] @@ -1459,7 +1576,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1468,6 +1585,7 @@ async def _run_command_initial( 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'], @@ -1475,7 +1593,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1491,7 +1613,7 @@ async def _run_command_initial( 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 @@ -1501,6 +1623,8 @@ async def begin_run_command( 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. @@ -1513,6 +1637,9 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2020_06_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 @@ -1527,8 +1654,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -1542,6 +1669,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1565,7 +1693,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_sets_operations.py index aac937a2d386..23e1f24d9a55 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -127,8 +132,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,10 +171,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -190,6 +197,7 @@ async def _update_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'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -211,7 +223,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -318,11 +338,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ async def begin_delete( raw_result = await self._delete_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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -406,17 +427,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,10 +458,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -446,6 +474,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -457,6 +486,7 @@ async def _deallocate_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'], @@ -464,7 +494,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -474,11 +508,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -493,7 +527,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -508,8 +543,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,6 +557,7 @@ 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 @@ -542,12 +579,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) + 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 + 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, @@ -560,6 +596,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -568,6 +605,7 @@ async def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -575,7 +613,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -585,11 +627,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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -617,8 +659,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -630,6 +673,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -651,10 +695,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) + 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 + 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( @@ -680,17 +723,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -704,7 +754,7 @@ async def get_instance_view( 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 @@ -724,6 +774,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -735,6 +787,7 @@ def prepare_request(next_link=None): 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) @@ -745,6 +798,7 @@ def prepare_request(next_link=None): 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) @@ -762,7 +816,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]: @@ -775,7 +833,7 @@ async def get_next(next_link=None): 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( @@ -793,6 +851,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -803,6 +863,7 @@ def prepare_request(next_link=None): 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) @@ -812,6 +873,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -829,7 +891,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]: @@ -842,7 +908,7 @@ async def get_next(next_link=None): 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( @@ -865,6 +931,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -877,6 +945,7 @@ def prepare_request(next_link=None): 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) @@ -888,6 +957,7 @@ def prepare_request(next_link=None): 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) @@ -905,7 +975,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]: @@ -918,7 +992,7 @@ async def get_next(next_link=None): 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( @@ -940,6 +1014,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -952,6 +1028,7 @@ def prepare_request(next_link=None): 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) @@ -963,6 +1040,7 @@ def prepare_request(next_link=None): 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) @@ -980,7 +1058,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]: @@ -993,9 +1075,9 @@ async def get_next(next_link=None): 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, @@ -1009,6 +1091,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1020,6 +1103,7 @@ async def _power_off_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, @@ -1028,7 +1112,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1038,11 +1126,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1060,9 +1148,10 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1077,8 +1166,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1091,6 +1181,7 @@ 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 @@ -1112,12 +1203,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) + 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 + 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, @@ -1130,6 +1220,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1141,6 +1232,7 @@ async def _restart_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'], @@ -1148,7 +1240,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1158,11 +1254,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1175,7 +1271,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1190,8 +1287,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1203,6 +1301,7 @@ 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 @@ -1224,12 +1323,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) + 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 + 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, @@ -1242,6 +1340,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1253,6 +1352,7 @@ async def _start_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'], @@ -1260,7 +1360,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +1374,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1287,7 +1391,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1302,8 +1407,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1315,6 +1421,7 @@ 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 @@ -1336,12 +1443,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) + 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 + 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, @@ -1354,6 +1460,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1365,6 +1472,7 @@ async def _redeploy_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'], @@ -1372,7 +1480,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1382,11 +1494,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1400,7 +1512,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1415,8 +1528,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1428,6 +1542,7 @@ 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 @@ -1449,12 +1564,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1467,6 +1581,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1478,6 +1593,7 @@ async def _perform_maintenance_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'], @@ -1485,7 +1601,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1495,11 +1615,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1515,7 +1635,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1530,8 +1651,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1543,6 +1665,7 @@ 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 @@ -1564,12 +1687,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1582,6 +1704,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1590,6 +1713,7 @@ async def _update_instances_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'], @@ -1597,7 +1721,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1607,11 +1735,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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1639,8 +1767,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1652,6 +1781,7 @@ 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 @@ -1673,12 +1803,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) + 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 + 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, @@ -1691,6 +1820,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -1702,6 +1832,7 @@ async def _reimage_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'], @@ -1709,7 +1840,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1719,11 +1854,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1738,7 +1873,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -1753,8 +1888,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1766,6 +1902,7 @@ 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 @@ -1787,12 +1924,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1805,6 +1941,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1816,6 +1953,7 @@ async def _reimage_all_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'], @@ -1823,7 +1961,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1833,11 +1975,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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1851,7 +1993,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1866,8 +2009,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1879,6 +2023,7 @@ 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 @@ -1900,10 +2045,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) + 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 + 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( @@ -1934,18 +2078,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -1959,11 +2110,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + async def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1990,6 +2141,7 @@ async def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -1998,6 +2150,7 @@ async def convert_to_single_placement_group( 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'], @@ -2005,7 +2158,11 @@ async def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2015,10 +2172,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, @@ -2031,6 +2188,7 @@ async def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -2039,6 +2197,7 @@ async def _set_orchestration_service_state_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'], @@ -2046,7 +2205,11 @@ async def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2056,11 +2219,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 @distributed_trace_async - async def begin_set_orchestration_service_state( + async def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2087,8 +2250,9 @@ async def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2100,6 +2264,7 @@ 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 @@ -2121,7 +2286,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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_sizes_operations.py index 2f93a4ec9966..a366c3a995d7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -64,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -85,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -102,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]: @@ -115,4 +121,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machines_operations.py index 000fc92bcae4..14133132e974 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -318,8 +338,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,6 +352,7 @@ 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 @@ -355,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -373,6 +394,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -381,6 +403,7 @@ async def _update_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'], @@ -388,7 +411,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -406,7 +433,7 @@ async def _update_initial( 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 @@ -439,8 +466,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -452,6 +480,7 @@ 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 @@ -476,12 +505,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) + 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 + 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, @@ -494,18 +522,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -515,11 +550,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -532,7 +567,8 @@ 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. @@ -546,7 +582,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -558,6 +595,7 @@ 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 ) @@ -578,10 +616,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -597,8 +634,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -611,18 +648,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -636,7 +680,7 @@ async def get( 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 @@ -663,17 +707,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -687,10 +738,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -702,17 +753,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -722,11 +780,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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -751,7 +809,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -762,6 +821,7 @@ 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 ) @@ -782,12 +842,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) + 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 + 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, @@ -799,17 +858,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -819,11 +885,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -848,7 +914,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -859,6 +926,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -879,13 +947,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -913,17 +980,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -933,7 +1007,7 @@ 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 @@ -954,6 +1028,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -965,6 +1041,7 @@ def prepare_request(next_link=None): 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) @@ -975,6 +1052,7 @@ def prepare_request(next_link=None): 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) @@ -992,7 +1070,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]: @@ -1005,7 +1087,7 @@ async def get_next(next_link=None): 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( @@ -1017,7 +1099,7 @@ 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 @@ -1026,6 +1108,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1036,6 +1120,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1046,6 +1131,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1064,7 +1150,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]: @@ -1077,7 +1167,7 @@ async def get_next(next_link=None): 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( @@ -1100,6 +1190,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1112,6 +1204,7 @@ def prepare_request(next_link=None): 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) @@ -1123,6 +1216,7 @@ def prepare_request(next_link=None): 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) @@ -1140,7 +1234,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]: @@ -1153,9 +1251,9 @@ async def get_next(next_link=None): 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, @@ -1168,18 +1266,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -1189,11 +1294,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1209,7 +1314,7 @@ 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. @@ -1223,7 +1328,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1235,6 +1341,7 @@ 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 ) @@ -1255,12 +1362,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _reapply_initial( + async def _reapply_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1272,17 +1378,24 @@ async def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -1292,11 +1405,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 @distributed_trace_async - async def begin_reapply( + async def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1320,7 +1433,8 @@ async def begin_reapply( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1331,6 +1445,7 @@ 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 ) @@ -1351,12 +1466,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) + 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 + begin_reapply.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1368,17 +1482,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -1388,11 +1509,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1416,7 +1537,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1427,6 +1549,7 @@ 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 ) @@ -1447,12 +1570,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) + 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 + 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, @@ -1464,17 +1586,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -1484,11 +1613,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1512,7 +1641,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1523,6 +1653,7 @@ 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 ) @@ -1543,12 +1674,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) + 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 + 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, @@ -1560,17 +1690,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -1580,11 +1717,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1608,7 +1745,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1619,6 +1757,7 @@ 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 ) @@ -1639,12 +1778,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) + 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 + 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, @@ -1657,6 +1795,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1668,6 +1807,7 @@ async def _reimage_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'], @@ -1675,7 +1815,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1685,11 +1829,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1702,7 +1846,8 @@ 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.v2020_06_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1716,8 +1861,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1729,6 +1875,7 @@ 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 @@ -1750,10 +1897,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) + 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 + 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( @@ -1771,7 +1917,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) @@ -1784,18 +1930,25 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -1809,10 +1962,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1824,17 +1977,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -1844,11 +2004,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1872,7 +2032,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1883,6 +2044,7 @@ 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 ) @@ -1903,13 +2065,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1932,17 +2093,24 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -1952,7 +2120,7 @@ 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( @@ -1967,17 +2135,24 @@ async def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -1993,7 +2168,7 @@ async def _assess_patches_initial( 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 @@ -2023,7 +2198,8 @@ async def begin_assess_patches( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -2034,6 +2210,7 @@ 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 ) @@ -2057,16 +2234,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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # 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"]] @@ -2075,7 +2253,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2083,6 +2261,7 @@ async def _run_command_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'], @@ -2090,7 +2269,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2106,7 +2289,7 @@ async def _run_command_initial( 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 @@ -2115,6 +2298,8 @@ async def begin_run_command( 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. @@ -2125,6 +2310,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2020_06_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 @@ -2139,8 +2327,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -2153,6 +2341,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2176,7 +2365,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py index 03b0f3eaf782..171d24463117 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_compute_management_client_enums.py @@ -163,7 +163,6 @@ class OrchestrationServiceNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enu """ AUTOMATIC_REPAIRS = "AutomaticRepairs" - DUMMY_ORCHESTRATION_SERVICE_NAME = "DummyOrchestrationServiceName" class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py index 16b50b5cf0ea..fb8ea0062715 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/models/_models_py3.py @@ -3373,7 +3373,7 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2020_06_01.models.OrchestrationServiceNames :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". @@ -3399,7 +3399,7 @@ def __init__( ): """ :keyword service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :paramtype service_name: str or ~azure.mgmt.compute.v2020_06_01.models.OrchestrationServiceNames :keyword action: Required. The action to be performed. Possible values include: "Resume", @@ -3417,8 +3417,7 @@ class OrchestrationServiceSummary(msrest.serialization.Model): 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". + :ivar service_name: The name of the service. Possible values include: "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2020_06_01.models.OrchestrationServiceNames :ivar service_state: The current state of the service. Possible values include: "NotRunning", "Running", "Suspended". diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_availability_sets_operations.py index 8b21bf90405d..cf0ce4ef30b9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -185,31 +187,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -253,31 +257,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,6 +335,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -338,6 +344,7 @@ def create_or_update( 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'], @@ -345,7 +352,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -359,7 +370,7 @@ def create_or_update( 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 @@ -389,6 +400,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -397,6 +409,7 @@ def update( 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'], @@ -404,7 +417,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +435,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -445,17 +462,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -465,7 +489,7 @@ 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 @@ -492,17 +516,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -516,7 +547,7 @@ def get( 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 @@ -528,7 +559,7 @@ 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 @@ -537,6 +568,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -547,6 +580,7 @@ def prepare_request(next_link=None): 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'], ) @@ -557,6 +591,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -575,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]: @@ -588,7 +627,7 @@ def get_next(next_link=None): 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( @@ -607,6 +646,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -618,6 +659,7 @@ def prepare_request(next_link=None): 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) @@ -628,6 +670,7 @@ def prepare_request(next_link=None): 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) @@ -645,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]: @@ -658,7 +705,7 @@ def get_next(next_link=None): 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( @@ -681,6 +728,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_host_groups_operations.py index 9877ba2d88e1..d20debd1a1b8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -188,30 +190,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -220,29 +223,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -297,6 +301,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -305,6 +310,7 @@ def create_or_update( 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'], @@ -312,7 +318,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -330,7 +340,7 @@ def create_or_update( 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 @@ -360,6 +370,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -368,6 +379,7 @@ def update( 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'], @@ -375,7 +387,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -389,11 +405,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -416,17 +432,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -436,7 +459,7 @@ 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 @@ -454,8 +477,8 @@ def get( :param host_group_name: The name of the dedicated host group. :type host_group_name: str :param expand: The expand expression to apply on the operation. The response shows the list of - instance view of the dedicated hosts under the dedicated host group. The default value is - "instanceView". + instance view of the dedicated hosts under the dedicated host group. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -468,18 +491,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -493,7 +523,7 @@ def get( 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 @@ -514,6 +544,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -525,6 +557,7 @@ def prepare_request(next_link=None): 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) @@ -535,6 +568,7 @@ def prepare_request(next_link=None): 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) @@ -552,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]: @@ -565,7 +603,7 @@ def get_next(next_link=None): 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( @@ -582,6 +620,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -592,6 +632,7 @@ def prepare_request(next_link=None): 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) @@ -601,6 +642,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -618,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]: @@ -631,4 +677,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_hosts_operations.py index a89eff61598a..27f2bef30a1a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_by_host_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -332,8 +341,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -346,6 +356,7 @@ 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 @@ -370,10 +381,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore def _update_initial( self, @@ -389,6 +399,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -398,6 +409,7 @@ def _update_initial( 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'], @@ -405,7 +417,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,7 +435,7 @@ def _update_initial( 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 @@ -454,8 +470,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,6 +485,7 @@ 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 @@ -492,12 +510,11 @@ 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) + 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 + 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: str, host_group_name: str, @@ -510,18 +527,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -531,11 +555,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -562,7 +586,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -574,6 +599,7 @@ 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 ) @@ -594,10 +620,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace def get( @@ -616,8 +641,8 @@ def get( :type host_group_name: str :param host_name: The name of the dedicated host. :type host_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -630,19 +655,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -656,7 +688,7 @@ def get( 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 @@ -680,6 +712,8 @@ def list_by_host_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -692,6 +726,7 @@ def prepare_request(next_link=None): 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) @@ -703,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -720,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]: @@ -733,4 +773,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_images_operations.py index a71c2659572a..0557d1b03bd9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -154,33 +155,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -291,6 +296,7 @@ def _create_or_update_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'], @@ -298,7 +304,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -316,7 +326,7 @@ def _create_or_update_initial( 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 @@ -347,8 +357,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -360,6 +371,7 @@ 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 @@ -384,10 +396,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -402,6 +413,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -410,6 +422,7 @@ def _update_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'], @@ -417,7 +430,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -435,7 +452,7 @@ def _update_initial( 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 @@ -466,8 +483,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +497,7 @@ 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 @@ -503,12 +522,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -520,17 +538,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -540,11 +565,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -568,7 +593,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,6 +605,7 @@ 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 ) @@ -599,10 +626,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -618,7 +644,7 @@ 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) @@ -631,18 +657,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -656,7 +689,7 @@ def get( 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 @@ -674,6 +707,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -685,6 +720,7 @@ def prepare_request(next_link=None): 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) @@ -695,6 +731,7 @@ def prepare_request(next_link=None): 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) @@ -712,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]: @@ -725,7 +766,7 @@ def get_next(next_link=None): 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( @@ -740,6 +781,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -750,6 +793,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -759,6 +803,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -776,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]: @@ -789,4 +838,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_log_analytics_operations.py index 6f9e59a13663..4cb58ae571f6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py index 7465524e7f1f..02c413057227 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_proximity_placement_groups_operations.py index fccb59f53333..6adc9bb65f9d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( include_colocation_status: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -187,29 +189,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -295,6 +299,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -303,6 +308,7 @@ def create_or_update( 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'], @@ -310,7 +316,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -328,7 +338,7 @@ def create_or_update( 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 @@ -358,6 +368,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -366,6 +377,7 @@ def update( 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'], @@ -373,7 +385,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -387,11 +403,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -414,17 +430,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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,7 +457,7 @@ 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 @@ -452,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) @@ -465,18 +488,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -490,7 +520,7 @@ def get( 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 @@ -507,6 +537,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -517,6 +549,7 @@ def prepare_request(next_link=None): 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) @@ -526,6 +559,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -543,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]: @@ -556,7 +594,7 @@ def get_next(next_link=None): 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( @@ -575,6 +613,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -586,6 +626,7 @@ def prepare_request(next_link=None): 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) @@ -596,6 +637,7 @@ def prepare_request(next_link=None): 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) @@ -613,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]: @@ -626,4 +672,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_ssh_public_keys_operations.py index df4287c1564f..101280d47a5d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,30 +64,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -100,35 +102,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -144,35 +146,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -185,25 +187,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -214,31 +217,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -249,31 +253,32 @@ def build_generate_key_pair_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -314,6 +319,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -324,6 +331,7 @@ def prepare_request(next_link=None): 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) @@ -333,6 +341,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -350,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]: @@ -363,7 +376,7 @@ def get_next(next_link=None): 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( @@ -383,6 +396,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -394,6 +409,7 @@ def prepare_request(next_link=None): 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) @@ -404,6 +420,7 @@ def prepare_request(next_link=None): 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) @@ -421,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]: @@ -434,7 +455,7 @@ def get_next(next_link=None): 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( @@ -463,6 +484,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -471,6 +493,7 @@ def create( 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'], @@ -478,7 +501,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def create( 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 @@ -526,6 +553,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -534,6 +562,7 @@ def update( 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'], @@ -541,7 +570,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -555,11 +588,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -582,17 +615,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -602,7 +642,7 @@ 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 @@ -629,17 +669,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -653,7 +700,7 @@ def get( 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 @@ -682,17 +729,24 @@ def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -706,5 +760,5 @@ def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_usage_operations.py index ca2e5a90a7d3..a5d20da73acb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extension_images_operations.py index 463523ced3cd..cafeb96d7b4b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extensions_operations.py index 31ea441e8759..26e2308a73d8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,9 +127,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -137,16 +138,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -160,10 +161,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -171,23 +173,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -200,33 +202,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,6 +269,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -275,6 +279,7 @@ def _create_or_update_initial( 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'], @@ -282,7 +287,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -300,7 +309,7 @@ def _create_or_update_initial( 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 @@ -338,8 +347,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,6 +362,7 @@ 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 @@ -376,10 +387,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -395,6 +405,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -404,6 +415,7 @@ def _update_initial( 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'], @@ -411,7 +423,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -425,7 +441,7 @@ def _update_initial( 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 @@ -463,8 +479,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,6 +494,7 @@ 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 @@ -501,12 +519,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -519,18 +536,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -540,11 +564,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -571,7 +595,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -583,6 +608,7 @@ 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 ) @@ -603,10 +629,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -625,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) @@ -638,19 +663,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -664,7 +696,7 @@ def get( 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 @@ -681,7 +713,7 @@ 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) @@ -694,18 +726,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -719,5 +758,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_images_operations.py index 9fa8b4fd7765..dfea888868d2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_run_commands_operations.py index c722616ba11d..009fbb61643a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,31 +69,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -107,12 +109,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -120,23 +122,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -153,12 +155,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -166,23 +168,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -196,10 +198,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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}') + _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'), @@ -207,21 +210,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -235,10 +238,11 @@ def build_get_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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}') + _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'), @@ -246,23 +250,23 @@ def build_get_by_virtual_machine_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -275,33 +279,34 @@ def build_list_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -344,6 +349,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -355,6 +362,7 @@ def prepare_request(next_link=None): 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) @@ -365,6 +373,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -382,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]: @@ -395,7 +408,7 @@ def get_next(next_link=None): 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( @@ -421,17 +434,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -445,7 +465,7 @@ def get( 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( @@ -454,6 +474,8 @@ 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"] @@ -462,7 +484,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -471,6 +493,7 @@ def _create_or_update_initial( 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'], @@ -478,7 +501,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def _create_or_update_initial( 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 @@ -506,6 +533,8 @@ def begin_create_or_update( 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. @@ -519,6 +548,9 @@ 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.v2020_06_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 @@ -533,8 +565,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -548,6 +580,7 @@ def begin_create_or_update( 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 ) @@ -571,10 +604,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore def _update_initial( self, @@ -582,6 +614,8 @@ 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"] @@ -590,7 +624,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -599,6 +633,7 @@ def _update_initial( 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'], @@ -606,7 +641,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +659,7 @@ def _update_initial( 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 @@ -630,6 +669,8 @@ def begin_update( 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. @@ -642,6 +683,9 @@ 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.v2020_06_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 @@ -656,8 +700,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -671,6 +715,7 @@ def begin_update( 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 ) @@ -694,12 +739,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -712,18 +756,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -733,11 +784,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -764,7 +815,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -776,6 +828,7 @@ 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 ) @@ -796,10 +849,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get_by_virtual_machine( @@ -818,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) @@ -831,19 +883,26 @@ def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -857,7 +916,7 @@ def get_by_virtual_machine( 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 @@ -874,7 +933,7 @@ 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 @@ -883,6 +942,8 @@ def list_by_virtual_machine( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -895,6 +956,7 @@ def prepare_request(next_link=None): 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'], ) @@ -907,6 +969,7 @@ def prepare_request(next_link=None): 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, ) @@ -925,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]: @@ -938,4 +1005,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_extensions_operations.py index febc4213f3db..4d62c350e393 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -336,8 +345,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -350,6 +360,7 @@ 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 @@ -374,10 +385,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore def _update_initial( self, @@ -393,6 +403,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -402,6 +413,7 @@ def _update_initial( 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'], @@ -409,7 +421,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,12 +521,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -521,18 +538,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -542,11 +566,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -573,7 +597,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -585,6 +610,7 @@ 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 ) @@ -605,10 +631,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -627,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) @@ -640,19 +665,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -666,7 +698,7 @@ def get( 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 @@ -689,6 +721,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -701,6 +735,7 @@ def prepare_request(next_link=None): 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) @@ -712,6 +747,7 @@ def prepare_request(next_link=None): 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) @@ -729,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]: @@ -742,4 +782,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 1b58d892b05f..7001630ee5a5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,25 +33,26 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -62,25 +63,26 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -91,25 +93,26 @@ def build_start_extension_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -120,31 +123,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -170,7 +174,7 @@ 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: str, vm_scale_set_name: str, @@ -182,17 +186,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -202,11 +213,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -230,7 +241,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -241,6 +253,7 @@ 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 ) @@ -261,12 +274,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -278,17 +290,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,11 +317,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -328,7 +347,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -339,6 +359,7 @@ 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 ) @@ -359,12 +380,11 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def _start_extension_upgrade_initial( + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -376,17 +396,24 @@ def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -396,11 +423,11 @@ 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 @distributed_trace - def begin_start_extension_upgrade( + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -426,7 +453,8 @@ def begin_start_extension_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -437,6 +465,7 @@ 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 ) @@ -457,10 +486,9 @@ 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) + 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 + begin_start_extension_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -486,17 +514,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -510,5 +545,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 8c0e80b9bc01..6f729c6c2524 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -53,23 +53,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -87,12 +87,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -101,23 +101,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -132,10 +132,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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}') + _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'), @@ -144,21 +145,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -173,10 +174,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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}') + _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'), @@ -185,23 +187,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,10 +217,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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') + _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'), @@ -226,23 +229,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +286,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') @@ -293,6 +297,7 @@ def _create_or_update_initial( 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'], @@ -300,7 +305,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -359,8 +368,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -374,6 +384,7 @@ 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 @@ -398,10 +409,9 @@ 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) + 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 + 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, @@ -418,6 +428,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') @@ -428,6 +439,7 @@ def _update_initial( 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'], @@ -435,7 +447,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -449,7 +465,7 @@ def _update_initial( 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 @@ -490,8 +506,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -505,6 +522,7 @@ 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 @@ -529,12 +547,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -548,6 +565,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -555,12 +574,17 @@ def _delete_initial( 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) - 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]: @@ -570,11 +594,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -604,7 +628,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -617,6 +642,7 @@ 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 ) @@ -637,10 +663,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -662,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) @@ -675,6 +700,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -682,13 +709,18 @@ def get( 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) - 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]: @@ -702,7 +734,7 @@ def get( 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 @@ -722,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) @@ -735,19 +767,26 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -761,5 +800,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index d2dc7cd43cba..d42d89a0ff1a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -133,10 +133,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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}') + _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'), @@ -145,21 +146,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -174,10 +175,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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}') + _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'), @@ -186,23 +188,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -216,10 +218,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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') + _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'), @@ -227,23 +230,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -276,6 +279,8 @@ 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"] @@ -284,7 +289,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -294,6 +299,7 @@ def _create_or_update_initial( 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'], @@ -301,7 +307,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -319,7 +329,7 @@ def _create_or_update_initial( 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 @@ -330,6 +340,8 @@ def begin_create_or_update( 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. @@ -344,6 +356,9 @@ 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.v2020_06_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 @@ -358,8 +373,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -374,6 +389,7 @@ def begin_create_or_update( 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 ) @@ -397,10 +413,9 @@ 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) + 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 + 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, @@ -409,6 +424,8 @@ 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"] @@ -417,7 +434,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -427,6 +444,7 @@ def _update_initial( 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'], @@ -434,7 +452,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -448,7 +470,7 @@ def _update_initial( 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 @@ -459,6 +481,8 @@ def begin_update( 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. @@ -473,6 +497,9 @@ 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.v2020_06_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 @@ -487,8 +514,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -503,6 +530,7 @@ def begin_update( 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 ) @@ -526,12 +554,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -545,6 +572,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -552,12 +581,17 @@ def _delete_initial( 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) - 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]: @@ -567,11 +601,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -601,7 +635,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -614,6 +649,7 @@ 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 ) @@ -634,10 +670,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get( @@ -659,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) @@ -672,6 +707,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -679,13 +716,18 @@ def get( 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) - 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]: @@ -699,7 +741,7 @@ def get( 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 @@ -719,7 +761,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -728,6 +770,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -741,6 +785,7 @@ def prepare_request(next_link=None): 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'], ) @@ -754,6 +799,7 @@ def prepare_request(next_link=None): 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, ) @@ -772,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]: @@ -785,4 +835,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vms_operations.py index 2e8412fec06e..bc1cc9c657cc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,11 +39,11 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -51,22 +51,22 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,9 +80,10 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -90,16 +91,16 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -111,9 +112,10 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -121,16 +123,16 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -145,12 +147,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -158,23 +160,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -188,9 +190,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -198,16 +201,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -221,10 +224,11 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -232,23 +236,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -260,10 +264,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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') + _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'), @@ -271,21 +276,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -300,37 +305,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -344,9 +350,10 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -354,18 +361,18 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -377,9 +384,10 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -387,16 +395,16 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -408,9 +416,10 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -418,16 +427,16 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -439,9 +448,10 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -449,16 +459,16 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -472,10 +482,11 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-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') + _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'), @@ -483,23 +494,23 @@ def build_retrieve_boot_diagnostics_data_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -511,9 +522,10 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -521,16 +533,16 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -542,9 +554,10 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + _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'), @@ -552,16 +565,16 @@ def build_simulate_eviction_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -576,12 +589,12 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -589,29 +602,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -633,7 +646,7 @@ 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: str, vm_scale_set_name: str, @@ -647,6 +660,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -659,6 +673,7 @@ def _reimage_initial( 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'], @@ -666,7 +681,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -676,11 +695,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -697,6 +716,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -711,8 +731,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -725,6 +746,7 @@ 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 @@ -746,12 +768,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -764,18 +785,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -785,11 +813,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -817,7 +845,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -829,6 +858,7 @@ 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 ) @@ -849,12 +879,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -867,18 +896,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -888,11 +924,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -921,7 +957,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -933,6 +970,7 @@ 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 ) @@ -953,10 +991,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -972,6 +1009,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -981,6 +1019,7 @@ def _update_initial( 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'], @@ -988,7 +1027,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1006,7 +1049,7 @@ def _update_initial( 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 @@ -1043,8 +1086,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -1057,6 +1101,7 @@ 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 @@ -1081,12 +1126,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1099,18 +1143,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1120,11 +1171,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1151,7 +1202,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1163,6 +1215,7 @@ def begin_delete( 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 ) @@ -1183,10 +1236,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1205,8 +1257,8 @@ def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. :type instance_id: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -1219,19 +1271,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -1245,7 +1304,7 @@ def get( 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 @@ -1275,18 +1334,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -1300,7 +1366,7 @@ def get_instance_view( 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 @@ -1321,12 +1387,13 @@ 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 @@ -1335,6 +1402,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1347,6 +1416,7 @@ def prepare_request(next_link=None): 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, @@ -1361,6 +1431,7 @@ def prepare_request(next_link=None): 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, @@ -1381,7 +1452,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]: @@ -1394,9 +1469,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1410,19 +1485,26 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -1432,11 +1514,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1456,7 +1538,7 @@ 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. @@ -1470,7 +1552,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1483,6 +1566,7 @@ 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 ) @@ -1503,12 +1587,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1521,18 +1604,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1542,11 +1632,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1573,7 +1663,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1585,6 +1676,7 @@ 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 ) @@ -1605,12 +1697,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1623,18 +1714,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1644,11 +1742,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1675,7 +1773,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1687,6 +1786,7 @@ 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 ) @@ -1707,12 +1807,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1725,18 +1824,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1746,11 +1852,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1778,7 +1884,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1790,6 +1897,7 @@ 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 ) @@ -1810,10 +1918,9 @@ 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) + 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 + 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( @@ -1835,7 +1942,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) @@ -1848,19 +1955,26 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-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) - 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]: @@ -1874,10 +1988,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1890,18 +2004,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1911,11 +2032,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1942,7 +2063,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1954,6 +2076,7 @@ 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 ) @@ -1974,13 +2097,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2006,18 +2128,25 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -2027,7 +2156,7 @@ 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( @@ -2036,6 +2165,8 @@ 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"]] @@ -2044,7 +2175,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2053,6 +2184,7 @@ def _run_command_initial( 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'], @@ -2060,7 +2192,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2076,7 +2212,7 @@ def _run_command_initial( 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 @@ -2086,6 +2222,8 @@ def begin_run_command( 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. @@ -2098,6 +2236,9 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2020_06_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 @@ -2111,8 +2252,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -2126,6 +2267,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2149,7 +2291,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_sets_operations.py index 14142d7206d0..e16c86162b9d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,31 +153,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,33 +192,33 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -232,33 +234,33 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -271,31 +273,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -305,30 +308,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -337,29 +341,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -370,31 +375,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -405,31 +411,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -444,35 +451,35 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -488,33 +495,33 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -530,33 +537,33 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -572,33 +579,33 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -614,33 +621,33 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -656,33 +663,33 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -698,33 +705,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -740,33 +747,33 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -781,32 +788,33 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -820,33 +828,33 @@ def build_convert_to_single_placement_group_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -862,39 +870,39 @@ def build_set_orchestration_service_state_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -929,6 +937,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -937,6 +946,7 @@ def _create_or_update_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'], @@ -944,7 +954,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -962,7 +976,7 @@ def _create_or_update_initial( 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 @@ -995,8 +1009,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1008,6 +1023,7 @@ 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 @@ -1032,10 +1048,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -1050,6 +1065,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -1058,6 +1074,7 @@ def _update_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'], @@ -1065,7 +1082,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1079,7 +1100,7 @@ def _update_initial( 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 @@ -1112,8 +1133,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1125,6 +1147,7 @@ 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 @@ -1149,12 +1172,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1166,17 +1188,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1186,11 +1215,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1214,7 +1243,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1225,6 +1255,7 @@ def begin_delete( raw_result = self._delete_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 ) @@ -1245,10 +1276,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1274,17 +1304,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1298,10 +1335,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1314,6 +1351,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1325,6 +1363,7 @@ def _deallocate_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'], @@ -1332,7 +1371,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1342,11 +1385,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1361,7 +1404,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1376,8 +1420,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1389,6 +1434,7 @@ 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 @@ -1410,12 +1456,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1428,6 +1473,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1436,6 +1482,7 @@ def _delete_instances_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._delete_instances_initial.metadata['url'], @@ -1443,7 +1490,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1453,11 +1504,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1485,8 +1536,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1498,6 +1550,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1519,10 +1572,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1548,17 +1600,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -1572,7 +1631,7 @@ def get_instance_view( 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 @@ -1592,6 +1651,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1603,6 +1664,7 @@ def prepare_request(next_link=None): 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) @@ -1613,6 +1675,7 @@ def prepare_request(next_link=None): 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) @@ -1630,7 +1693,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]: @@ -1643,7 +1710,7 @@ def get_next(next_link=None): 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( @@ -1661,6 +1728,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1671,6 +1740,7 @@ def prepare_request(next_link=None): 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) @@ -1680,6 +1750,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1697,7 +1768,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]: @@ -1710,7 +1785,7 @@ def get_next(next_link=None): 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( @@ -1733,6 +1808,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1745,6 +1822,7 @@ def prepare_request(next_link=None): 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) @@ -1756,6 +1834,7 @@ def prepare_request(next_link=None): 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) @@ -1773,7 +1852,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]: @@ -1786,7 +1869,7 @@ def get_next(next_link=None): 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( @@ -1808,6 +1891,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1820,6 +1905,7 @@ def prepare_request(next_link=None): 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) @@ -1831,6 +1917,7 @@ def prepare_request(next_link=None): 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) @@ -1848,7 +1935,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]: @@ -1861,9 +1952,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1877,6 +1968,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1888,6 +1980,7 @@ def _power_off_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, @@ -1896,7 +1989,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1906,11 +2003,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1928,9 +2025,10 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1945,8 +2043,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1959,6 +2058,7 @@ 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 @@ -1980,12 +2080,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1998,6 +2097,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2009,6 +2109,7 @@ def _restart_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'], @@ -2016,7 +2117,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2026,11 +2131,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2043,7 +2148,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2058,8 +2164,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2071,6 +2178,7 @@ 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 @@ -2092,12 +2200,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2110,6 +2217,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2121,6 +2229,7 @@ def _start_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'], @@ -2128,7 +2237,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2138,11 +2251,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2155,7 +2268,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2170,8 +2284,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2183,6 +2298,7 @@ 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 @@ -2204,12 +2320,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2222,6 +2337,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2233,6 +2349,7 @@ def _redeploy_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'], @@ -2240,7 +2357,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2250,11 +2371,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2268,7 +2389,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2283,8 +2405,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2296,6 +2419,7 @@ 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 @@ -2317,12 +2441,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2335,6 +2458,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2346,6 +2470,7 @@ def _perform_maintenance_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'], @@ -2353,7 +2478,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2363,11 +2492,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2383,7 +2512,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2398,8 +2528,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2411,6 +2542,7 @@ 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 @@ -2432,12 +2564,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2450,6 +2581,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2458,6 +2590,7 @@ def _update_instances_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'], @@ -2465,7 +2598,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2475,11 +2612,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2507,8 +2644,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2520,6 +2658,7 @@ 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 @@ -2541,12 +2680,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2559,6 +2697,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -2570,6 +2709,7 @@ def _reimage_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'], @@ -2577,7 +2717,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2587,11 +2731,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2606,7 +2750,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2020_06_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -2621,8 +2765,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2634,6 +2779,7 @@ 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 @@ -2655,12 +2801,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2673,6 +2818,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2684,6 +2830,7 @@ def _reimage_all_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'], @@ -2691,7 +2838,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2701,11 +2852,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2719,7 +2870,8 @@ 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. + :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.v2020_06_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2734,8 +2886,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2747,6 +2900,7 @@ 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 @@ -2768,10 +2922,9 @@ 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) + 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 + 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( @@ -2802,18 +2955,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -2827,11 +2987,11 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2858,6 +3018,7 @@ def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2866,6 +3027,7 @@ def convert_to_single_placement_group( 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'], @@ -2873,7 +3035,11 @@ def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2883,10 +3049,10 @@ 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: str, vm_scale_set_name: str, @@ -2899,6 +3065,7 @@ def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -2907,6 +3074,7 @@ def _set_orchestration_service_state_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'], @@ -2914,7 +3082,11 @@ def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2924,11 +3096,11 @@ 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 @distributed_trace - def begin_set_orchestration_service_state( + def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2955,8 +3127,9 @@ def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2968,6 +3141,7 @@ 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 @@ -2989,7 +3163,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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_sizes_operations.py index 5813ab07306d..0d506b8f1e91 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,6 +99,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -109,6 +112,7 @@ def prepare_request(next_link=None): 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) @@ -119,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machines_operations.py index 11a4aebdcaeb..d206d44fa3c5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -202,27 +203,28 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -235,33 +237,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -272,31 +275,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -307,25 +311,26 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -336,25 +341,26 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -365,25 +371,26 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -393,30 +400,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -427,31 +435,32 @@ def build_list_all_request( status_only: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -462,31 +471,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -499,27 +509,28 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -530,31 +541,32 @@ def build_reapply_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -565,25 +577,26 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -594,25 +607,26 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -623,25 +637,26 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -655,33 +670,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -696,33 +711,34 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -733,25 +749,26 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -762,25 +779,26 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -791,31 +809,32 @@ def build_assess_patches_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-01" + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -829,41 +848,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -902,6 +921,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -913,6 +934,7 @@ def prepare_request(next_link=None): 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) @@ -923,6 +945,7 @@ def prepare_request(next_link=None): 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) @@ -940,7 +963,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]: @@ -953,7 +980,7 @@ def get_next(next_link=None): 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, @@ -968,6 +995,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -976,6 +1004,7 @@ def _capture_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'], @@ -983,7 +1012,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -999,7 +1032,7 @@ def _capture_initial( 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 @@ -1033,8 +1066,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1046,6 +1080,7 @@ 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 @@ -1070,10 +1105,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -1088,6 +1122,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -1096,6 +1131,7 @@ def _create_or_update_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'], @@ -1103,7 +1139,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1121,7 +1161,7 @@ def _create_or_update_initial( 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 @@ -1154,8 +1194,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1167,6 +1208,7 @@ 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 @@ -1191,10 +1233,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1209,6 +1250,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1217,6 +1259,7 @@ def _update_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'], @@ -1224,7 +1267,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1242,7 +1289,7 @@ def _update_initial( 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 @@ -1274,8 +1321,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1287,6 +1335,7 @@ 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 @@ -1311,12 +1360,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1329,18 +1377,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -1350,11 +1405,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1367,7 +1422,8 @@ 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. @@ -1381,7 +1437,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1393,6 +1450,7 @@ 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 ) @@ -1413,10 +1471,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1432,8 +1489,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1446,18 +1503,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -1471,7 +1535,7 @@ def get( 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 @@ -1498,17 +1562,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -1522,10 +1593,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1537,17 +1608,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1557,11 +1635,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1586,7 +1664,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1597,6 +1676,7 @@ 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 ) @@ -1617,12 +1697,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1634,17 +1713,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1654,11 +1740,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1683,7 +1769,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1694,6 +1781,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1714,13 +1802,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1748,17 +1835,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -1768,7 +1862,7 @@ 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 @@ -1789,6 +1883,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1800,6 +1896,7 @@ def prepare_request(next_link=None): 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) @@ -1810,6 +1907,7 @@ def prepare_request(next_link=None): 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) @@ -1827,7 +1925,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]: @@ -1840,7 +1942,7 @@ def get_next(next_link=None): 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( @@ -1852,7 +1954,7 @@ 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 @@ -1861,6 +1963,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1871,6 +1975,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1881,6 +1986,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1899,7 +2005,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]: @@ -1912,7 +2022,7 @@ def get_next(next_link=None): 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( @@ -1935,6 +2045,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1947,6 +2059,7 @@ def prepare_request(next_link=None): 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) @@ -1958,6 +2071,7 @@ def prepare_request(next_link=None): 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) @@ -1975,7 +2089,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]: @@ -1988,9 +2106,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -2003,18 +2121,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -2024,11 +2149,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2044,7 +2169,7 @@ 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. @@ -2058,7 +2183,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2070,6 +2196,7 @@ 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 ) @@ -2090,12 +2217,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2107,17 +2233,24 @@ def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -2127,11 +2260,11 @@ 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 @distributed_trace - def begin_reapply( + def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2155,7 +2288,8 @@ def begin_reapply( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2166,6 +2300,7 @@ 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 ) @@ -2186,12 +2321,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2203,17 +2337,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -2223,11 +2364,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2251,7 +2392,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2262,6 +2404,7 @@ 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 ) @@ -2282,12 +2425,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2299,17 +2441,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -2319,11 +2468,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2347,7 +2496,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2358,6 +2508,7 @@ 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 ) @@ -2378,12 +2529,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2395,17 +2545,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -2415,11 +2572,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2443,7 +2600,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2454,6 +2612,7 @@ 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 ) @@ -2474,12 +2633,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2492,6 +2650,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -2503,6 +2662,7 @@ def _reimage_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'], @@ -2510,7 +2670,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2520,11 +2684,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2537,7 +2701,8 @@ 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.v2020_06_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2551,8 +2716,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2564,6 +2730,7 @@ 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 @@ -2585,10 +2752,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore @distributed_trace def retrieve_boot_diagnostics_data( @@ -2606,7 +2772,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) @@ -2619,18 +2785,25 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -2644,10 +2817,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2659,17 +2832,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -2679,11 +2859,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2707,7 +2887,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2718,6 +2899,7 @@ 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 ) @@ -2738,13 +2920,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2767,17 +2948,24 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: str + 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) - 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]: @@ -2787,7 +2975,7 @@ 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( @@ -2802,17 +2990,24 @@ def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-01") # type: 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) - 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]: @@ -2828,7 +3023,7 @@ def _assess_patches_initial( 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 @@ -2858,7 +3053,8 @@ def begin_assess_patches( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -2869,6 +3065,7 @@ 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 ) @@ -2892,16 +3089,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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore def _run_command_initial( self, resource_group_name: 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"]] @@ -2910,7 +3108,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-06-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2918,6 +3116,7 @@ def _run_command_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'], @@ -2925,7 +3124,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2941,7 +3144,7 @@ def _run_command_initial( 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 @@ -2950,6 +3153,8 @@ def begin_run_command( 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. @@ -2960,6 +3165,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2020_06_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 @@ -2973,8 +3181,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-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( 'polling_interval', @@ -2987,6 +3195,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -3010,7 +3219,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_compute_management_client.py index e5be43023750..d096c3b92476 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -38,8 +39,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-06-30". 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. """ @@ -66,7 +70,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_configuration.py index bdd03597c3f9..284c8173674a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2020-06-30". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-06-30" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_metadata.json index c22618f21a56..02be27c9fb8a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_compute_management_client.py index 6f99c6609a2f..0a931a0fcfd2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -38,8 +39,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-06-30". 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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_configuration.py index 4abf311f1620..c21db50ce1c1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/_configuration.py @@ -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 "2020-06-30". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-06-30" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_accesses_operations.py index f1d96d564f82..d86dabc3f1d5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace_async async def get_private_link_resources( @@ -602,17 +646,24 @@ async def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -626,5 +677,5 @@ async def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_encryption_sets_operations.py index f0ee76a8b21d..53ac65821e68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -130,8 +135,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -167,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -193,6 +200,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,7 +230,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -254,8 +266,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,6 +280,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -291,10 +305,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async async def get( @@ -322,17 +335,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -346,10 +366,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -361,17 +381,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -381,11 +408,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -411,7 +438,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -422,6 +450,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -442,10 +471,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -464,6 +492,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -475,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -485,6 +516,7 @@ def prepare_request(next_link=None): 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) @@ -502,7 +534,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]: @@ -515,7 +551,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -531,6 +567,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -541,6 +579,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -550,6 +589,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -567,7 +607,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]: @@ -580,7 +624,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -603,6 +647,8 @@ def list_associated_resources( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -615,6 +661,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -626,6 +673,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -643,7 +691,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]: @@ -656,4 +708,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disks_operations.py index a38b66abd610..d44a812dcbc4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_snapshots_operations.py index c565c0c824e4..cdf8b9b58476 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_06_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_06_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_accesses_operations.py index dca985c66f4c..f9c2fe9a9a13 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_get_private_link_resources_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -320,6 +325,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -328,6 +334,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -335,7 +342,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -353,7 +364,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -386,8 +397,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -399,6 +411,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -423,10 +436,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore def _update_initial( self, @@ -441,6 +453,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -449,6 +462,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -456,7 +470,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -474,7 +492,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -507,8 +525,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -520,6 +539,7 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -544,10 +564,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def get( @@ -575,17 +594,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -599,10 +625,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -614,17 +640,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -634,11 +667,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -664,7 +697,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -675,6 +709,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -695,10 +730,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -715,6 +749,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -726,6 +762,7 @@ def prepare_request(next_link=None): 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) @@ -736,6 +773,7 @@ def prepare_request(next_link=None): 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) @@ -753,7 +791,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]: @@ -766,7 +808,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -780,6 +822,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -790,6 +834,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -799,6 +844,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -816,7 +862,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]: @@ -829,7 +879,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def get_private_link_resources( @@ -857,17 +907,24 @@ def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -881,5 +938,5 @@ def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_encryption_sets_operations.py index a9ed452d0e74..2ff07274b6b3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_list_associated_resources_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -320,6 +325,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -328,6 +334,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -335,7 +342,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -353,7 +364,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -388,8 +399,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -401,6 +413,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -425,10 +438,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore def _update_initial( self, @@ -443,6 +455,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -451,6 +464,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -458,7 +472,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -476,7 +494,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -511,8 +529,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -524,6 +543,7 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -548,10 +568,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def get( @@ -579,17 +598,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -603,10 +629,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -618,17 +644,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -638,11 +671,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -668,7 +701,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -679,6 +713,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -699,10 +734,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -721,6 +755,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -732,6 +768,7 @@ def prepare_request(next_link=None): 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) @@ -742,6 +779,7 @@ def prepare_request(next_link=None): 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) @@ -759,7 +797,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]: @@ -772,7 +814,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -788,6 +830,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -798,6 +842,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -807,6 +852,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -824,7 +870,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]: @@ -837,7 +887,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -859,6 +909,8 @@ def list_associated_resources( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -871,6 +923,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -882,6 +935,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -899,7 +953,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]: @@ -912,4 +970,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disks_operations.py index 7da9fc61a63c..5c4c8bf5ce0d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_snapshots_operations.py index c9b67d22455e..1c6f99af34b4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_06_30/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-06-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-06-30" + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_06_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_06_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-06-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-06-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_compute_management_client.py index 0c189f6f3ee5..d7d84ec5de05 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar disks: DisksOperations operations @@ -65,8 +66,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-09-30". 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. """ @@ -103,7 +107,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_configuration.py index 80f17d9a926a..9c0f4347314a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2020-09-30". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-09-30" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_metadata.json index bd6f0d35f3a7..98de701a1ac7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_compute_management_client.py index 7d341a44343f..aa38461e01b6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar disks: DisksOperations operations @@ -66,8 +67,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-09-30". 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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_configuration.py index 87ddc35fcbab..6436e7212f18 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/_configuration.py @@ -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 "2020-09-30". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-09-30" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_accesses_operations.py index becdc53fb54b..1f311492fdb6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace_async async def get_private_link_resources( @@ -602,17 +646,24 @@ async def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -626,7 +677,7 @@ async def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore async def _update_a_private_endpoint_connection_initial( @@ -643,6 +694,7 @@ async def _update_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -652,6 +704,7 @@ async def _update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], @@ -659,7 +712,11 @@ async def _update_a_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -677,7 +734,7 @@ async def _update_a_private_endpoint_connection_initial( return deserialized - _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -718,8 +775,9 @@ async def begin_update_a_private_endpoint_connection( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -732,6 +790,7 @@ async def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -756,10 +815,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_update_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async async def get_a_private_endpoint_connection( @@ -790,18 +848,25 @@ async def get_a_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_a_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_a_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -815,10 +880,10 @@ async def get_a_private_endpoint_connection( return deserialized - get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - async def _delete_a_private_endpoint_connection_initial( + async def _delete_a_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -831,18 +896,25 @@ async def _delete_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_a_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -852,11 +924,11 @@ async def _delete_a_private_endpoint_connection_initial( if cls: return cls(pipeline_response, None, {}) - _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete_a_private_endpoint_connection( + async def begin_delete_a_private_endpoint_connection( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -885,7 +957,8 @@ async def begin_delete_a_private_endpoint_connection( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -897,6 +970,7 @@ async def begin_delete_a_private_endpoint_connection( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -917,10 +991,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_private_endpoint_connections( @@ -944,6 +1017,8 @@ def list_private_endpoint_connections( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -956,6 +1031,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) @@ -967,6 +1043,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -984,7 +1061,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]: @@ -997,4 +1078,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_encryption_sets_operations.py index faf55954826f..0339aa0ef7d4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -130,8 +135,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -167,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -193,6 +200,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,7 +230,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -254,8 +266,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,6 +280,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -291,10 +305,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async async def get( @@ -322,17 +335,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -346,10 +366,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -361,17 +381,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -381,11 +408,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -411,7 +438,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -422,6 +450,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -442,10 +471,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -464,6 +492,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -475,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -485,6 +516,7 @@ def prepare_request(next_link=None): 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) @@ -502,7 +534,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]: @@ -515,7 +551,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -531,6 +567,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -541,6 +579,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -550,6 +589,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -567,7 +607,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]: @@ -580,7 +624,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -603,6 +647,8 @@ def list_associated_resources( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -615,6 +661,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -626,6 +673,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -643,7 +691,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]: @@ -656,4 +708,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_restore_point_operations.py index 93f647173eab..343ca472801b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disk_restore_point_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -81,6 +80,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -88,12 +89,17 @@ async def get( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_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) - 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 +113,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}"} # type: ignore @distributed_trace @@ -137,6 +143,8 @@ def list_by_restore_point( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -150,6 +158,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=self.list_by_restore_point.metadata['url'], ) request = _convert_request(request) @@ -162,6 +171,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -179,7 +189,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]: @@ -192,4 +206,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + list_by_restore_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disks_operations.py index 33eb4ac6fe3c..794f6957d4cf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_galleries_operations.py index 84b14333c87b..466f05416552 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -97,7 +102,7 @@ async def _create_or_update_initial( 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 @@ -130,8 +135,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ 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 @@ -167,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'GalleryUpdate') @@ -193,6 +200,7 @@ async def _update_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'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -214,7 +226,7 @@ async def _update_initial( 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 @@ -247,8 +259,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -260,6 +273,7 @@ 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 @@ -284,10 +298,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace_async async def get( @@ -303,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.v2020_09_30.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) @@ -316,18 +329,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: 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) - 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]: @@ -341,10 +361,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -356,17 +376,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: 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) - 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]: @@ -376,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -404,7 +431,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -415,6 +443,7 @@ 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 ) @@ -435,10 +464,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -456,6 +484,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -467,6 +497,7 @@ def prepare_request(next_link=None): 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) @@ -477,6 +508,7 @@ def prepare_request(next_link=None): 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) @@ -494,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]: @@ -507,7 +543,7 @@ async def get_next(next_link=None): 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( @@ -522,6 +558,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -532,6 +570,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -541,6 +580,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -558,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]: @@ -571,4 +615,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_application_versions_operations.py index 9e7220b0029a..f9190000e77c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -147,8 +152,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -162,6 +168,7 @@ 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 @@ -186,10 +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) + 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 + 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, @@ -206,6 +212,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') @@ -216,6 +223,7 @@ async def _update_initial( 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'], @@ -223,7 +231,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -237,7 +249,7 @@ async def _update_initial( 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 @@ -283,8 +295,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -298,6 +311,7 @@ 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 @@ -322,10 +336,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) + 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 + 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( @@ -350,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.v2020_09_30.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) @@ -363,6 +376,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -370,13 +385,18 @@ async def get( 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) - 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]: @@ -390,10 +410,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -407,6 +427,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -414,12 +436,17 @@ async def _delete_initial( 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) - 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]: @@ -429,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -466,7 +493,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +507,7 @@ 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 ) @@ -499,10 +528,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) + 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 + 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( @@ -529,6 +557,8 @@ def list_by_gallery_application( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -542,6 +572,7 @@ def prepare_request(next_link=None): 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) @@ -554,6 +585,7 @@ def prepare_request(next_link=None): 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) @@ -571,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]: @@ -584,4 +620,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_applications_operations.py index f9bdaead362c..26ffd8aab9fd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplication') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -139,8 +144,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -153,6 +159,7 @@ 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 @@ -177,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore async def _update_initial( self, @@ -196,6 +202,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') @@ -205,6 +212,7 @@ async def _update_initial( 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'], @@ -212,7 +220,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -265,8 +277,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,6 +292,7 @@ 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 @@ -303,10 +317,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace_async async def get( @@ -337,18 +350,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # 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, + 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(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]: @@ -362,10 +382,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -378,18 +398,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # 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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -399,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -431,7 +458,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,6 +471,7 @@ 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 ) @@ -463,10 +492,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -489,6 +517,8 @@ def list_by_gallery( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -501,6 +531,7 @@ def prepare_request(next_link=None): 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) @@ -512,6 +543,7 @@ def prepare_request(next_link=None): 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) @@ -529,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]: @@ -542,4 +578,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_image_versions_operations.py index 4da0ba29f8ed..8b32cd038c33 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -146,8 +151,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -161,6 +167,7 @@ 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 @@ -185,10 +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) + 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 + 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, @@ -205,6 +211,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') @@ -215,6 +222,7 @@ async def _update_initial( 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'], @@ -222,7 +230,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -236,7 +248,7 @@ async def _update_initial( 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 @@ -281,8 +293,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,6 +309,7 @@ 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 @@ -320,10 +334,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) + 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 + 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( @@ -347,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.v2020_09_30.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) @@ -360,6 +373,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -367,13 +382,18 @@ async def get( 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) - 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]: @@ -387,10 +407,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -404,6 +424,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -411,12 +433,17 @@ async def _delete_initial( 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) - 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]: @@ -426,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -462,7 +489,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -475,6 +503,7 @@ 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 ) @@ -495,10 +524,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) + 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 + 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( @@ -525,6 +553,8 @@ def list_by_gallery_image( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -538,6 +568,7 @@ def prepare_request(next_link=None): 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) @@ -550,6 +581,7 @@ def prepare_request(next_link=None): 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) @@ -567,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]: @@ -580,4 +616,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_images_operations.py index c4151ddd0b82..18d5c62e9743 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,6 +157,7 @@ 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 @@ -175,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore async def _update_initial( self, @@ -194,6 +200,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') @@ -203,6 +210,7 @@ async def _update_initial( 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'], @@ -210,7 +218,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -224,7 +236,7 @@ async def _update_initial( 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 @@ -262,8 +274,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,6 +289,7 @@ 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 @@ -300,10 +314,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace_async async def get( @@ -333,18 +346,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # 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, + 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(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]: @@ -358,10 +378,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -374,18 +394,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # 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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -395,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -427,7 +454,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -439,6 +467,7 @@ 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 ) @@ -459,10 +488,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -484,6 +512,8 @@ def list_by_gallery( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -496,6 +526,7 @@ def prepare_request(next_link=None): 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) @@ -507,6 +538,7 @@ def prepare_request(next_link=None): 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) @@ -524,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]: @@ -537,4 +573,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_sharing_profile_operations.py index 8a5632388a74..e6b33f708c7f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_sharing_profile_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_gallery_sharing_profile_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -59,6 +58,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(sharing_update, 'SharingUpdate') @@ -67,6 +67,7 @@ async def _update_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'], @@ -74,7 +75,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -92,7 +97,7 @@ async def _update_initial( 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 @@ -125,8 +130,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.SharingUpdate] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,7 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_galleries_operations.py index 7b14bb5ba815..58d1ba789691 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,7 +57,7 @@ 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.v2020_09_30.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedGalleryList or the result of cls(response) @@ -66,6 +65,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -77,6 +78,7 @@ def prepare_request(next_link=None): 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'], ) @@ -88,6 +90,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, location=location, + api_version=api_version, shared_to=shared_to, template_url=next_link, ) @@ -106,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]: @@ -119,7 +126,7 @@ async def get_next(next_link=None): 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( @@ -145,17 +152,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: 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) - 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,5 +183,5 @@ async def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_image_versions_operations.py index fb2e4f1b9fe6..bdbc4cf31ff5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -65,7 +64,7 @@ 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.v2020_09_30.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedGalleryImageVersionList or the result of @@ -74,6 +73,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -87,6 +88,7 @@ def prepare_request(next_link=None): 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'], ) @@ -100,6 +102,7 @@ def prepare_request(next_link=None): 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, ) @@ -118,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]: @@ -131,7 +138,7 @@ async def get_next(next_link=None): 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( @@ -167,6 +174,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -174,12 +183,17 @@ async def get( 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) - 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]: @@ -193,5 +207,5 @@ async def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_images_operations.py index 8e8467cf7faf..79c74f9983ba 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_shared_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,7 +60,7 @@ 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.v2020_09_30.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedGalleryImageList or the result of @@ -70,6 +69,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -82,6 +83,7 @@ def prepare_request(next_link=None): 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'], ) @@ -94,6 +96,7 @@ def prepare_request(next_link=None): 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, ) @@ -112,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]: @@ -125,7 +132,7 @@ async def get_next(next_link=None): 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( @@ -155,18 +162,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # 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, + 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(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]: @@ -180,5 +194,5 @@ async def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_snapshots_operations.py index d83091027329..f40435668354 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_09_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_accesses_operations.py index 363282b9cd4b..6c8f5c718f31 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_get_private_link_resources_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -296,12 +301,12 @@ def build_update_a_private_endpoint_connection_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -309,23 +314,23 @@ def build_update_a_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -339,10 +344,11 @@ def build_get_a_private_endpoint_connection_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -350,21 +356,21 @@ def build_get_a_private_endpoint_connection_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -376,10 +382,11 @@ def build_delete_a_private_endpoint_connection_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -387,21 +394,21 @@ def build_delete_a_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -412,31 +419,32 @@ def build_list_private_endpoint_connections_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -475,6 +483,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -483,6 +492,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -490,7 +500,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -508,7 +522,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -541,8 +555,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -554,6 +569,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -578,10 +594,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore def _update_initial( self, @@ -596,6 +611,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -604,6 +620,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -611,7 +628,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -629,7 +650,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -662,8 +683,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -675,6 +697,7 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -699,10 +722,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def get( @@ -730,17 +752,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -754,10 +783,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -769,17 +798,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -789,11 +825,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -819,7 +855,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -830,6 +867,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -850,10 +888,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -870,6 +907,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -881,6 +920,7 @@ def prepare_request(next_link=None): 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) @@ -891,6 +931,7 @@ def prepare_request(next_link=None): 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) @@ -908,7 +949,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]: @@ -921,7 +966,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -935,6 +980,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -945,6 +992,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -954,6 +1002,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -971,7 +1020,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]: @@ -984,7 +1037,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def get_private_link_resources( @@ -1012,17 +1065,24 @@ def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1036,7 +1096,7 @@ def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore def _update_a_private_endpoint_connection_initial( @@ -1053,6 +1113,7 @@ def _update_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -1062,6 +1123,7 @@ def _update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], @@ -1069,7 +1131,11 @@ def _update_a_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1087,7 +1153,7 @@ def _update_a_private_endpoint_connection_initial( return deserialized - _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace @@ -1128,8 +1194,9 @@ def begin_update_a_private_endpoint_connection( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -1142,6 +1209,7 @@ def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1166,10 +1234,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_update_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def get_a_private_endpoint_connection( @@ -1200,18 +1267,25 @@ def get_a_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_a_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_a_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1225,10 +1299,10 @@ def get_a_private_endpoint_connection( return deserialized - get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - def _delete_a_private_endpoint_connection_initial( + def _delete_a_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -1241,18 +1315,25 @@ def _delete_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_a_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1262,11 +1343,11 @@ def _delete_a_private_endpoint_connection_initial( if cls: return cls(pipeline_response, None, {}) - _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete_a_private_endpoint_connection( + def begin_delete_a_private_endpoint_connection( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -1295,7 +1376,8 @@ def begin_delete_a_private_endpoint_connection( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,6 +1389,7 @@ def begin_delete_a_private_endpoint_connection( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1327,10 +1410,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_private_endpoint_connections( @@ -1354,6 +1436,8 @@ def list_private_endpoint_connections( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1366,6 +1450,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) @@ -1377,6 +1462,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1394,7 +1480,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]: @@ -1407,4 +1497,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_encryption_sets_operations.py index 928a1f2ce979..e8a8ec693322 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_list_associated_resources_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -320,6 +325,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -328,6 +334,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -335,7 +342,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -353,7 +364,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -388,8 +399,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -401,6 +413,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -425,10 +438,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore def _update_initial( self, @@ -443,6 +455,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -451,6 +464,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -458,7 +472,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -476,7 +494,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -511,8 +529,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -524,6 +543,7 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -548,10 +568,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def get( @@ -579,17 +598,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -603,10 +629,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -618,17 +644,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -638,11 +671,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -668,7 +701,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -679,6 +713,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -699,10 +734,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -721,6 +755,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -732,6 +768,7 @@ def prepare_request(next_link=None): 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) @@ -742,6 +779,7 @@ def prepare_request(next_link=None): 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) @@ -759,7 +797,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]: @@ -772,7 +814,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -788,6 +830,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -798,6 +842,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -807,6 +852,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -824,7 +870,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]: @@ -837,7 +887,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -859,6 +909,8 @@ def list_associated_resources( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -871,6 +923,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -882,6 +935,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -899,7 +953,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]: @@ -912,4 +970,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_restore_point_operations.py index 636def144e46..c21776d101d0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_restore_point_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( disk_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}") # 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'), @@ -46,21 +47,21 @@ def build_get_request( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,10 +73,11 @@ def build_list_by_restore_point_request( vm_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints") # 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'), @@ -83,21 +85,21 @@ def build_list_by_restore_point_request( "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,6 +160,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -165,12 +169,17 @@ def get( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_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) - 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]: @@ -184,7 +193,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}"} # type: ignore @distributed_trace @@ -214,6 +223,8 @@ def list_by_restore_point( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -227,6 +238,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=self.list_by_restore_point.metadata['url'], ) request = _convert_request(request) @@ -239,6 +251,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -256,7 +269,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]: @@ -269,4 +286,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + list_by_restore_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disks_operations.py index e8900f3a8e13..b5dce990dd00 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py index 436ca8066ef9..3d71393103c9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -125,33 +125,34 @@ def build_get_request( select: Optional[Union[str, "_models.SelectPermissions"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,31 +163,32 @@ def build_delete_request_initial( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,30 +198,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -228,29 +231,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -289,6 +293,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -297,6 +302,7 @@ def _create_or_update_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'], @@ -304,7 +310,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -325,7 +335,7 @@ def _create_or_update_initial( 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 @@ -357,8 +367,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -370,6 +381,7 @@ 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 @@ -394,10 +406,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore def _update_initial( self, @@ -412,6 +423,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'GalleryUpdate') @@ -420,6 +432,7 @@ def _update_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'], @@ -427,7 +440,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -441,7 +458,7 @@ def _update_initial( 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 @@ -473,8 +490,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,6 +504,7 @@ 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 @@ -510,10 +529,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def get( @@ -529,7 +547,7 @@ 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.v2020_09_30.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) @@ -542,18 +560,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: 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) - 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]: @@ -567,10 +592,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -582,17 +607,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: 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) - 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]: @@ -602,11 +634,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -630,7 +662,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -641,6 +674,7 @@ 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 ) @@ -661,10 +695,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -681,6 +714,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -692,6 +727,7 @@ def prepare_request(next_link=None): 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) @@ -702,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -719,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]: @@ -732,7 +773,7 @@ def get_next(next_link=None): 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( @@ -746,6 +787,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -756,6 +799,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -765,6 +809,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -782,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]: @@ -795,4 +844,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_application_versions_operations.py index 01cd1feb2bde..7498c07e0be0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -135,10 +135,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # 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}') + _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'), @@ -147,23 +148,23 @@ def build_get_request( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -176,10 +177,11 @@ def build_delete_request_initial( gallery_application_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # 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}') + _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'), @@ -188,21 +190,21 @@ def build_delete_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -214,10 +216,11 @@ def build_list_by_gallery_application_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions') + _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'), @@ -225,21 +228,21 @@ def build_list_by_gallery_application_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -280,6 +283,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') @@ -290,6 +294,7 @@ def _create_or_update_initial( 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'], @@ -297,7 +302,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -364,8 +373,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -379,6 +389,7 @@ 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 @@ -403,10 +414,9 @@ 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) + 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 + 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, @@ -423,6 +433,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') @@ -433,6 +444,7 @@ def _update_initial( 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'], @@ -440,7 +452,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -454,7 +470,7 @@ def _update_initial( 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 @@ -500,8 +516,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -515,6 +532,7 @@ 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 @@ -539,10 +557,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore @distributed_trace def get( @@ -567,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.v2020_09_30.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) @@ -580,6 +597,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -587,13 +606,18 @@ def get( 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) - 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]: @@ -607,10 +631,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -624,6 +648,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -631,12 +657,17 @@ def _delete_initial( 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) - 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]: @@ -646,11 +677,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -683,7 +714,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -696,6 +728,7 @@ 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 ) @@ -716,10 +749,9 @@ 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) + 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 + 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( @@ -746,6 +778,8 @@ def list_by_gallery_application( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -759,6 +793,7 @@ def prepare_request(next_link=None): 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) @@ -771,6 +806,7 @@ def prepare_request(next_link=None): 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) @@ -788,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]: @@ -801,4 +841,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_applications_operations.py index 24c32509b727..a515713becb6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_get_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -139,21 +140,21 @@ def build_get_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,10 +166,11 @@ def build_delete_request_initial( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -176,21 +178,21 @@ def build_delete_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -201,31 +203,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,6 +268,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplication') @@ -274,6 +278,7 @@ def _create_or_update_initial( 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'], @@ -281,7 +286,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -302,7 +311,7 @@ def _create_or_update_initial( 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 @@ -342,8 +351,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -356,6 +366,7 @@ 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 @@ -380,10 +391,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore def _update_initial( self, @@ -399,6 +409,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') @@ -408,6 +419,7 @@ def _update_initial( 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'], @@ -415,7 +427,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -429,7 +445,7 @@ def _update_initial( 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 @@ -468,8 +484,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -482,6 +499,7 @@ 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 @@ -506,10 +524,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def get( @@ -540,18 +557,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # 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, + 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(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]: @@ -565,10 +589,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -581,18 +605,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # 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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -602,11 +633,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -634,7 +665,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -646,6 +678,7 @@ 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 ) @@ -666,10 +699,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -692,6 +724,8 @@ def list_by_gallery( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -704,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -715,6 +750,7 @@ def prepare_request(next_link=None): 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) @@ -732,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]: @@ -745,4 +785,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_image_versions_operations.py index c1faa55c45a9..aa217341678c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -135,10 +135,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # 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}') + _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'), @@ -147,23 +148,23 @@ def build_get_request( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -176,10 +177,11 @@ def build_delete_request_initial( gallery_image_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # 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}') + _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'), @@ -188,21 +190,21 @@ def build_delete_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -214,10 +216,11 @@ def build_list_by_gallery_image_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions') + _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'), @@ -225,21 +228,21 @@ def build_list_by_gallery_image_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -280,6 +283,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -290,6 +294,7 @@ def _create_or_update_initial( 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'], @@ -297,7 +302,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -363,8 +372,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -378,6 +388,7 @@ 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 @@ -402,10 +413,9 @@ 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) + 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 + 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, @@ -422,6 +432,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') @@ -432,6 +443,7 @@ def _update_initial( 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'], @@ -439,7 +451,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -453,7 +469,7 @@ def _update_initial( 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 @@ -498,8 +514,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -513,6 +530,7 @@ 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 @@ -537,10 +555,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore @distributed_trace def get( @@ -564,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.v2020_09_30.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) @@ -577,6 +594,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -584,13 +603,18 @@ def get( 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) - 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]: @@ -604,10 +628,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -621,6 +645,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -628,12 +654,17 @@ def _delete_initial( 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) - 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]: @@ -643,11 +674,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -679,7 +710,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -692,6 +724,7 @@ 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 ) @@ -712,10 +745,9 @@ 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) + 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 + 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( @@ -742,6 +774,8 @@ def list_by_gallery_image( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -755,6 +789,7 @@ def prepare_request(next_link=None): 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) @@ -767,6 +802,7 @@ def prepare_request(next_link=None): 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) @@ -784,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]: @@ -797,4 +837,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_images_operations.py index 533642b7d107..51ee8a139bda 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_get_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -139,21 +140,21 @@ def build_get_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,10 +166,11 @@ def build_delete_request_initial( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -176,21 +178,21 @@ def build_delete_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -201,31 +203,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,6 +268,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -274,6 +278,7 @@ def _create_or_update_initial( 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'], @@ -281,7 +286,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -302,7 +311,7 @@ def _create_or_update_initial( 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 @@ -340,8 +349,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -354,6 +364,7 @@ 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 @@ -378,10 +389,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore def _update_initial( self, @@ -397,6 +407,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') @@ -406,6 +417,7 @@ def _update_initial( 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'], @@ -413,7 +425,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,10 +521,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def get( @@ -536,18 +553,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # 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, + 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(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]: @@ -561,10 +585,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -577,18 +601,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # 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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -598,11 +629,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -630,7 +661,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -642,6 +674,7 @@ 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 ) @@ -662,10 +695,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -686,6 +718,8 @@ def list_by_gallery( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -698,6 +732,7 @@ def prepare_request(next_link=None): 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) @@ -709,6 +744,7 @@ def prepare_request(next_link=None): 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) @@ -726,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]: @@ -739,4 +779,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_sharing_profile_operations.py index 09659ceecb3d..2127d5c3e62b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_sharing_profile_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_gallery_sharing_profile_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,35 +37,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -106,6 +106,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(sharing_update, 'SharingUpdate') @@ -114,6 +115,7 @@ def _update_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'], @@ -121,7 +123,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -139,7 +145,7 @@ def _update_initial( 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 @@ -171,8 +177,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.SharingUpdate] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( 'polling_interval', @@ -184,6 +191,7 @@ 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 @@ -208,7 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_galleries_operations.py index 37f8152da32b..ace50147728f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,32 +33,33 @@ def build_list_request( shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -69,31 +70,32 @@ def build_get_request( gallery_unique_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -131,13 +133,15 @@ 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.v2020_09_30.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedGalleryList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -149,6 +153,7 @@ def prepare_request(next_link=None): 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'], ) @@ -160,6 +165,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, location=location, + api_version=api_version, shared_to=shared_to, template_url=next_link, ) @@ -178,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]: @@ -191,7 +201,7 @@ def get_next(next_link=None): 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( @@ -217,17 +227,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: 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) - 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]: @@ -241,5 +258,5 @@ def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_image_versions_operations.py index afa55f7cfb96..068485d1d315 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_list_request( shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions') + _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'), @@ -46,23 +47,23 @@ def build_list_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -75,10 +76,11 @@ def build_get_request( gallery_image_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # 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}') + _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'), @@ -87,21 +89,21 @@ def build_get_request( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -146,7 +148,7 @@ 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.v2020_09_30.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedGalleryImageVersionList or the result of @@ -155,6 +157,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -168,6 +172,7 @@ def prepare_request(next_link=None): 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'], ) @@ -181,6 +186,7 @@ def prepare_request(next_link=None): 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, ) @@ -199,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]: @@ -212,7 +222,7 @@ def get_next(next_link=None): 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( @@ -248,6 +258,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -255,12 +267,17 @@ def get( 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) - 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]: @@ -274,5 +291,5 @@ def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_images_operations.py index c6f6f2a52123..65ee9671afb0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_shared_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,33 +34,34 @@ def build_list_request( shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,10 +73,11 @@ def build_get_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}') + _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'), @@ -83,21 +85,21 @@ def build_get_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -138,7 +140,7 @@ 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.v2020_09_30.models.SharedToValues :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SharedGalleryImageList or the result of @@ -147,6 +149,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.SharedGalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedGalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -159,6 +163,7 @@ def prepare_request(next_link=None): 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'], ) @@ -171,6 +176,7 @@ def prepare_request(next_link=None): 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, ) @@ -189,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]: @@ -202,7 +212,7 @@ def get_next(next_link=None): 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( @@ -232,18 +242,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # 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, + 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(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]: @@ -257,5 +274,5 @@ def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_snapshots_operations.py index fe15c9607cc0..7a71cf12e486 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-09-30" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-09-30" + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_09_30.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_09_30.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-09-30") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-09-30") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py index 4c88f462a55c..a4050ab247d6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -41,8 +42,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-10-01-preview". 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. """ @@ -69,7 +73,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py index d555505a76bc..a77883a13ef4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2020-10-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-10-01-preview" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json index 119180b2f4e0..c39b846b1bb7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py index 5cbb578ec5de..2bc54d56d9c5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -41,8 +42,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-10-01-preview". 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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py index 0cc835b99229..5b99b8dfef3e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/_configuration.py @@ -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 "2020-10-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-10-01-preview" + 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py index fe959c0e315d..768094719346 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_role_instances_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -48,7 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -61,18 +60,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_delete_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -82,11 +88,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -113,7 +119,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -125,6 +132,7 @@ async def begin_delete( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -145,10 +153,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace_async async def get( @@ -167,8 +174,8 @@ async def get( :type resource_group_name: str :param cloud_service_name: :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. The default value is - "instanceView". + :param expand: The expand expression to apply to the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RoleInstance, or the result of cls(response) @@ -181,19 +188,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -207,7 +221,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace_async @@ -237,18 +251,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_instance_view_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_instance_view.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,7 +283,7 @@ async def get_instance_view( return deserialized - get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView'} # type: ignore + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView"} # type: ignore @distributed_trace @@ -281,8 +302,8 @@ def list( :type resource_group_name: str :param cloud_service_name: :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. The default value is - "instanceView". + :param expand: The expand expression to apply to the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleInstanceListResult or the result of @@ -291,6 +312,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -303,6 +326,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=self.list.metadata['url'], ) @@ -315,6 +339,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -333,7 +358,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]: @@ -346,9 +375,9 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -361,18 +390,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_restart_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -382,11 +418,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart"} # type: ignore @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -414,7 +450,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -426,6 +463,7 @@ async def begin_restart( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -446,12 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart"} # type: ignore - async def _reimage_initial( + async def _reimage_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -464,18 +501,25 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_reimage_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -485,11 +529,11 @@ async def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage"} # type: ignore @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -517,7 +561,8 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -529,6 +574,7 @@ async def begin_reimage( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -549,12 +595,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage"} # type: ignore - async def _rebuild_initial( + async def _rebuild_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -567,18 +612,25 @@ async def _rebuild_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_rebuild_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._rebuild_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -588,11 +640,11 @@ async def _rebuild_initial( if cls: return cls(pipeline_response, None, {}) - _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + _rebuild_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild"} # type: ignore @distributed_trace_async - async def begin_rebuild( + async def begin_rebuild( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -621,7 +673,8 @@ async def begin_rebuild( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -633,6 +686,7 @@ async def begin_rebuild( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -653,10 +707,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + begin_rebuild.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild"} # type: ignore @distributed_trace_async async def get_remote_desktop_file( @@ -685,18 +738,25 @@ async def get_remote_desktop_file( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_remote_desktop_file_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_remote_desktop_file.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -710,5 +770,5 @@ async def get_remote_desktop_file( return deserialized - get_remote_desktop_file.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile'} # type: ignore + get_remote_desktop_file.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py index 54aa12d87d13..15aaa62414dc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_service_roles_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,18 +72,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_request( role_name=role_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + 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(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 +104,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}"} # type: ignore @distributed_trace @@ -122,6 +128,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRoleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -134,6 +142,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -145,6 +154,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -162,7 +172,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]: @@ -175,4 +189,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py index cf11d744dd9b..31076fb246f2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CloudServicesOperations: +class CloudServicesOperations: # pylint: disable=too-many-public-methods """CloudServicesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -72,6 +72,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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'], @@ -79,7 +80,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -97,7 +102,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace_async @@ -115,7 +120,7 @@ async def begin_create_or_update( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: The cloud service object. + :param parameters: The cloud service object. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -131,8 +136,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,6 +150,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -168,10 +175,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore async def _update_initial( self, @@ -186,6 +192,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -197,6 +204,7 @@ async def _update_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -204,7 +212,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,7 +230,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace_async @@ -235,7 +247,7 @@ async def begin_update( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: The cloud service object. + :param parameters: The cloud service object. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -251,8 +263,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -264,6 +277,7 @@ async def begin_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -288,12 +302,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -305,17 +318,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -325,11 +345,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -353,7 +373,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -364,6 +385,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -384,10 +406,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace_async async def get( @@ -413,17 +434,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -437,7 +465,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace_async @@ -464,17 +492,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_instance_view_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_instance_view.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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 +523,7 @@ async def get_instance_view( return deserialized - get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView'} # type: ignore + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView"} # type: ignore @distributed_trace @@ -507,6 +542,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -517,6 +554,7 @@ def prepare_request(next_link=None): 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) @@ -526,6 +564,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -543,7 +582,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]: @@ -556,7 +599,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices'} # type: ignore + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices"} # type: ignore @distributed_trace def list( @@ -577,6 +620,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -588,6 +633,7 @@ def prepare_request(next_link=None): 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) @@ -598,6 +644,7 @@ def prepare_request(next_link=None): 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) @@ -615,7 +662,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]: @@ -628,9 +679,9 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices"} # type: ignore - async def _start_initial( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -642,17 +693,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -662,11 +720,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -690,7 +748,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -701,6 +760,7 @@ async def begin_start( raw_result = await self._start_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -721,12 +781,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start"} # type: ignore - async def _power_off_initial( + async def _power_off_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -738,17 +797,24 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_power_off_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -758,11 +824,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/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff"} # type: ignore @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -787,7 +853,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -798,6 +865,7 @@ async def begin_power_off( raw_result = await self._power_off_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -818,12 +886,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -836,6 +903,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -847,6 +915,7 @@ async def _restart_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._restart_initial.metadata['url'], @@ -854,7 +923,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -864,11 +937,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart"} # type: ignore @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -881,7 +954,7 @@ async def begin_restart( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -895,8 +968,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -908,6 +982,7 @@ async def begin_restart( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -929,12 +1004,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart"} # type: ignore - async def _reimage_initial( + async def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -947,6 +1021,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -958,6 +1033,7 @@ async def _reimage_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._reimage_initial.metadata['url'], @@ -965,7 +1041,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -975,11 +1055,11 @@ async def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage"} # type: ignore @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -993,7 +1073,7 @@ async def begin_reimage( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1007,8 +1087,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1020,6 +1101,7 @@ async def begin_reimage( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1041,12 +1123,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage"} # type: ignore - async def _rebuild_initial( + async def _rebuild_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1059,6 +1140,7 @@ async def _rebuild_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1070,6 +1152,7 @@ async def _rebuild_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._rebuild_initial.metadata['url'], @@ -1077,7 +1160,11 @@ async def _rebuild_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1087,11 +1174,11 @@ async def _rebuild_initial( if cls: return cls(pipeline_response, None, {}) - _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + _rebuild_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild"} # type: ignore @distributed_trace_async - async def begin_rebuild( + async def begin_rebuild( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1106,7 +1193,7 @@ async def begin_rebuild( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1120,8 +1207,9 @@ async def begin_rebuild( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1133,6 +1221,7 @@ async def begin_rebuild( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1154,12 +1243,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + begin_rebuild.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild"} # type: ignore - async def _delete_instances_initial( + async def _delete_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1172,6 +1260,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1183,6 +1272,7 @@ async def _delete_instances_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._delete_instances_initial.metadata['url'], @@ -1190,7 +1280,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1200,11 +1294,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/cloudServices/{cloudServiceName}/delete'} # type: ignore + _delete_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete"} # type: ignore @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1217,7 +1311,7 @@ async def begin_delete_instances( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1231,8 +1325,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1244,6 +1339,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1265,7 +1361,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py index 0fdf7bc5cbda..44c2d0eb2f2d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/aio/operations/_cloud_services_update_domain_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -48,7 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _walk_update_domain_initial( + async def _walk_update_domain_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -62,6 +61,7 @@ async def _walk_update_domain_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -74,6 +74,7 @@ async def _walk_update_domain_initial( cloud_service_name=cloud_service_name, update_domain=update_domain, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._walk_update_domain_initial.metadata['url'], @@ -81,7 +82,11 @@ async def _walk_update_domain_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +96,11 @@ async def _walk_update_domain_initial( if cls: return cls(pipeline_response, None, {}) - _walk_update_domain_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + _walk_update_domain_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace_async - async def begin_walk_update_domain( + async def begin_walk_update_domain( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -113,7 +118,7 @@ async def begin_walk_update_domain( domains are identified with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. :type update_domain: int - :param parameters: The update domain object. + :param parameters: The update domain object. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -127,8 +132,9 @@ async def begin_walk_update_domain( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_walk_update_domain( cloud_service_name=cloud_service_name, update_domain=update_domain, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -162,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_walk_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + begin_walk_update_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace_async async def get_update_domain( @@ -198,18 +204,25 @@ async def get_update_domain( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_update_domain_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, update_domain=update_domain, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_update_domain.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -223,7 +236,7 @@ async def get_update_domain( return deserialized - get_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + get_update_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace @@ -246,6 +259,8 @@ def list_update_domains( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomainListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomainListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -258,6 +273,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_update_domains.metadata['url'], ) request = _convert_request(request) @@ -269,6 +285,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -286,7 +303,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]: @@ -299,4 +320,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_update_domains.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains'} # type: ignore + list_update_domains.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py index 01a58d85d168..e9755b2a06c5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_role_instances_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -46,21 +47,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -74,10 +75,11 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -85,23 +87,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -113,10 +115,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -124,21 +127,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -151,33 +154,34 @@ def build_list_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -189,10 +193,11 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -200,21 +205,21 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -226,10 +231,11 @@ def build_reimage_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -237,21 +243,21 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,10 +269,11 @@ def build_rebuild_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -274,21 +281,21 @@ def build_rebuild_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -300,10 +307,11 @@ def build_get_remote_desktop_file_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/x-rdp" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -311,21 +319,21 @@ def build_get_remote_desktop_file_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -351,7 +359,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -364,18 +372,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_delete_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -385,11 +400,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -416,7 +431,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -428,6 +444,7 @@ def begin_delete( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -448,10 +465,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace def get( @@ -470,8 +486,8 @@ def get( :type resource_group_name: str :param cloud_service_name: :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. The default value is - "instanceView". + :param expand: The expand expression to apply to the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RoleInstance, or the result of cls(response) @@ -484,19 +500,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -510,7 +533,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace @@ -540,18 +563,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_instance_view_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_instance_view.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -565,7 +595,7 @@ def get_instance_view( return deserialized - get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView'} # type: ignore + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView"} # type: ignore @distributed_trace @@ -584,8 +614,8 @@ def list( :type resource_group_name: str :param cloud_service_name: :type cloud_service_name: str - :param expand: The expand expression to apply to the operation. The default value is - "instanceView". + :param expand: The expand expression to apply to the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleInstanceListResult or the result of @@ -594,6 +624,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -606,6 +638,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=self.list.metadata['url'], ) @@ -618,6 +651,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -636,7 +670,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]: @@ -649,9 +687,9 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -664,18 +702,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_restart_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -685,11 +730,11 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart"} # type: ignore @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -717,7 +762,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -729,6 +775,7 @@ def begin_restart( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -749,12 +796,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -767,18 +813,25 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_reimage_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -788,11 +841,11 @@ def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage"} # type: ignore @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -820,7 +873,8 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -832,6 +886,7 @@ def begin_reimage( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -852,12 +907,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage"} # type: ignore - def _rebuild_initial( + def _rebuild_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -870,18 +924,25 @@ def _rebuild_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_rebuild_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._rebuild_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -891,11 +952,11 @@ def _rebuild_initial( if cls: return cls(pipeline_response, None, {}) - _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + _rebuild_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild"} # type: ignore @distributed_trace - def begin_rebuild( + def begin_rebuild( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -924,7 +985,8 @@ def begin_rebuild( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -936,6 +998,7 @@ def begin_rebuild( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -956,10 +1019,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + begin_rebuild.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild"} # type: ignore @distributed_trace def get_remote_desktop_file( @@ -988,18 +1050,25 @@ def get_remote_desktop_file( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_remote_desktop_file_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_remote_desktop_file.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1013,5 +1082,5 @@ def get_remote_desktop_file( return deserialized - get_remote_desktop_file.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile'} # type: ignore + get_remote_desktop_file.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py index 2f73f3303d25..6293b03a3a9b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_service_roles_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}") # pylint: disable=line-too-long path_format_arguments = { "roleName": _SERIALIZER.url("role_name", role_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -44,21 +45,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -69,31 +70,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -146,18 +148,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_request( role_name=role_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + 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(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]: @@ -171,7 +180,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}"} # type: ignore @distributed_trace @@ -195,6 +204,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRoleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -207,6 +218,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -218,6 +230,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -235,7 +248,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]: @@ -248,4 +265,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py index ebbd6a0c0ea3..031b041b4329 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-10-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-10-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -193,31 +195,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -226,29 +229,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -258,30 +262,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -292,31 +297,32 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -327,31 +333,32 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -365,35 +372,35 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-10-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -409,35 +416,35 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-10-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -453,35 +460,35 @@ def build_rebuild_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-10-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -497,41 +504,41 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-10-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class CloudServicesOperations(object): +class CloudServicesOperations(object): # pylint: disable=too-many-public-methods """CloudServicesOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -566,6 +573,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -577,6 +585,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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'], @@ -584,7 +593,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -602,7 +615,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace @@ -620,7 +633,7 @@ def begin_create_or_update( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: The cloud service object. + :param parameters: The cloud service object. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -636,8 +649,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -649,6 +663,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -673,10 +688,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore def _update_initial( self, @@ -691,6 +705,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -702,6 +717,7 @@ def _update_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -709,7 +725,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -723,7 +743,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace @@ -740,7 +760,7 @@ def begin_update( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: The cloud service object. + :param parameters: The cloud service object. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -756,8 +776,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_10_01_preview.models.CloudService] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -769,6 +790,7 @@ def begin_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -793,12 +815,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -810,17 +831,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -830,11 +858,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -858,7 +886,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -869,6 +898,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -889,10 +919,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace def get( @@ -918,17 +947,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -942,7 +978,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace @@ -969,17 +1005,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_instance_view_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_instance_view.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -993,7 +1036,7 @@ def get_instance_view( return deserialized - get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView'} # type: ignore + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView"} # type: ignore @distributed_trace @@ -1012,6 +1055,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1022,6 +1067,7 @@ def prepare_request(next_link=None): 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) @@ -1031,6 +1077,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1048,7 +1095,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]: @@ -1061,7 +1112,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices'} # type: ignore + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices"} # type: ignore @distributed_trace def list( @@ -1082,6 +1133,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1093,6 +1146,7 @@ def prepare_request(next_link=None): 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) @@ -1103,6 +1157,7 @@ def prepare_request(next_link=None): 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) @@ -1120,7 +1175,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]: @@ -1133,9 +1192,9 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1147,17 +1206,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -1167,11 +1233,11 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start"} # type: ignore @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1195,7 +1261,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1206,6 +1273,7 @@ def begin_start( raw_result = self._start_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1226,12 +1294,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start"} # type: ignore - def _power_off_initial( + def _power_off_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1243,17 +1310,24 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_power_off_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1263,11 +1337,11 @@ def _power_off_initial( if cls: return cls(pipeline_response, None, {}) - _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff"} # type: ignore @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1292,7 +1366,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1303,6 +1378,7 @@ def begin_power_off( raw_result = self._power_off_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1323,12 +1399,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1341,6 +1416,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1352,6 +1428,7 @@ def _restart_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._restart_initial.metadata['url'], @@ -1359,7 +1436,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1369,11 +1450,11 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart"} # type: ignore @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1386,7 +1467,7 @@ def begin_restart( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1400,8 +1481,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1413,6 +1495,7 @@ def begin_restart( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1434,12 +1517,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1452,6 +1534,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1463,6 +1546,7 @@ def _reimage_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._reimage_initial.metadata['url'], @@ -1470,7 +1554,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1480,11 +1568,11 @@ def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage"} # type: ignore @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1498,7 +1586,7 @@ def begin_reimage( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1512,8 +1600,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1525,6 +1614,7 @@ def begin_reimage( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1546,12 +1636,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage"} # type: ignore - def _rebuild_initial( + def _rebuild_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1564,6 +1653,7 @@ def _rebuild_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1575,6 +1665,7 @@ def _rebuild_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._rebuild_initial.metadata['url'], @@ -1582,7 +1673,11 @@ def _rebuild_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1592,11 +1687,11 @@ def _rebuild_initial( if cls: return cls(pipeline_response, None, {}) - _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + _rebuild_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild"} # type: ignore @distributed_trace - def begin_rebuild( + def begin_rebuild( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1611,7 +1706,7 @@ def begin_rebuild( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1625,8 +1720,9 @@ def begin_rebuild( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1638,6 +1734,7 @@ def begin_rebuild( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1659,12 +1756,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + begin_rebuild.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild"} # type: ignore - def _delete_instances_initial( + def _delete_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1677,6 +1773,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1688,6 +1785,7 @@ def _delete_instances_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._delete_instances_initial.metadata['url'], @@ -1695,7 +1793,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1705,11 +1807,11 @@ def _delete_instances_initial( if cls: return cls(pipeline_response, None, {}) - _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + _delete_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete"} # type: ignore @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1722,7 +1824,7 @@ def begin_delete_instances( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1736,8 +1838,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1749,6 +1852,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1770,7 +1874,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py index b02259241fcf..8729673102c8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_10_01_preview/operations/_cloud_services_update_domain_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_walk_update_domain_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-10-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), @@ -52,23 +52,23 @@ def build_walk_update_domain_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,10 +82,11 @@ def build_get_update_domain_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), @@ -93,21 +94,21 @@ def build_get_update_domain_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -118,31 +119,32 @@ def build_list_update_domains_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-10-01-preview" + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -168,7 +170,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _walk_update_domain_initial( + def _walk_update_domain_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -182,6 +184,7 @@ def _walk_update_domain_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -194,6 +197,7 @@ def _walk_update_domain_initial( cloud_service_name=cloud_service_name, update_domain=update_domain, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._walk_update_domain_initial.metadata['url'], @@ -201,7 +205,11 @@ def _walk_update_domain_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -211,11 +219,11 @@ def _walk_update_domain_initial( if cls: return cls(pipeline_response, None, {}) - _walk_update_domain_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + _walk_update_domain_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace - def begin_walk_update_domain( + def begin_walk_update_domain( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -233,7 +241,7 @@ def begin_walk_update_domain( domains are identified with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. :type update_domain: int - :param parameters: The update domain object. + :param parameters: The update domain object. Default value is None. :type parameters: ~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomain :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -247,8 +255,9 @@ def begin_walk_update_domain( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +270,7 @@ def begin_walk_update_domain( cloud_service_name=cloud_service_name, update_domain=update_domain, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -282,10 +292,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_walk_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + begin_walk_update_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace def get_update_domain( @@ -318,18 +327,25 @@ def get_update_domain( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + request = build_get_update_domain_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, update_domain=update_domain, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_update_domain.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -343,7 +359,7 @@ def get_update_domain( return deserialized - get_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + get_update_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace @@ -366,6 +382,8 @@ def list_update_domains( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_10_01_preview.models.UpdateDomainListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-10-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomainListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -378,6 +396,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_update_domains.metadata['url'], ) request = _convert_request(request) @@ -389,6 +408,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -406,7 +426,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]: @@ -419,4 +443,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_update_domains.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains'} # type: ignore + list_update_domains.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_compute_management_client.py index 21ef5dfe9037..03a90c694921 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar disks: DisksOperations operations @@ -104,8 +105,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-12-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. """ @@ -155,7 +159,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_configuration.py index 055c3e81f07f..572e47e31ad5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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 "2020-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-12-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_metadata.json index 7d0063375aaf..dbb0c7489c91 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_compute_management_client.py index 02e28badf664..dce00be65053 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar disks: DisksOperations operations @@ -106,8 +107,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2020-12-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_configuration.py index 97667428c467..0dc06f858ce0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/_configuration.py @@ -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 "2020-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-12-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_availability_sets_operations.py index 7dfdf102b88f..dd852a8c458f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_host_groups_operations.py index b58619705ce6..daa3b6e01aab 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -138,6 +143,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -146,6 +152,7 @@ async def update( 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'], @@ -153,7 +160,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -167,11 +178,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -194,17 +205,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -214,7 +232,7 @@ 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 @@ -232,8 +250,8 @@ async def get( :param host_group_name: The name of the dedicated host group. :type host_group_name: str :param expand: The expand expression to apply on the operation. The response shows the list of - instance view of the dedicated hosts under the dedicated host group. The default value is - "instanceView". + instance view of the dedicated hosts under the dedicated host group. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -246,18 +264,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -271,7 +296,7 @@ async def get( 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 @@ -292,6 +317,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -303,6 +330,7 @@ def prepare_request(next_link=None): 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) @@ -313,6 +341,7 @@ def prepare_request(next_link=None): 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) @@ -330,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]: @@ -343,7 +376,7 @@ async def get_next(next_link=None): 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( @@ -360,6 +393,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -370,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -379,6 +415,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -396,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]: @@ -409,4 +450,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_hosts_operations.py index 15d26e158415..1ed9a17ba399 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -255,8 +267,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,6 +282,7 @@ 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 @@ -293,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -311,18 +324,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -332,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -363,7 +383,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -375,6 +396,7 @@ 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 ) @@ -395,10 +417,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace_async async def get( @@ -417,8 +438,8 @@ async def get( :type host_group_name: str :param host_name: The name of the dedicated host. :type host_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -431,19 +452,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -457,7 +485,7 @@ async def get( 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 @@ -481,6 +509,8 @@ def list_by_host_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -493,6 +523,7 @@ def prepare_request(next_link=None): 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) @@ -504,6 +535,7 @@ def prepare_request(next_link=None): 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) @@ -521,7 +553,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]: @@ -534,4 +570,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_accesses_operations.py index 6821394caa47..8029d354615b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace_async async def get_private_link_resources( @@ -602,17 +646,24 @@ async def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -626,7 +677,7 @@ async def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore async def _update_a_private_endpoint_connection_initial( @@ -643,6 +694,7 @@ async def _update_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -652,6 +704,7 @@ async def _update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], @@ -659,7 +712,11 @@ async def _update_a_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -677,7 +734,7 @@ async def _update_a_private_endpoint_connection_initial( return deserialized - _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -718,8 +775,9 @@ async def begin_update_a_private_endpoint_connection( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -732,6 +790,7 @@ async def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -756,10 +815,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_update_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async async def get_a_private_endpoint_connection( @@ -790,18 +848,25 @@ async def get_a_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_a_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_a_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -815,10 +880,10 @@ async def get_a_private_endpoint_connection( return deserialized - get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - async def _delete_a_private_endpoint_connection_initial( + async def _delete_a_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -831,18 +896,25 @@ async def _delete_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_a_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -852,11 +924,11 @@ async def _delete_a_private_endpoint_connection_initial( if cls: return cls(pipeline_response, None, {}) - _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete_a_private_endpoint_connection( + async def begin_delete_a_private_endpoint_connection( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -885,7 +957,8 @@ async def begin_delete_a_private_endpoint_connection( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -897,6 +970,7 @@ async def begin_delete_a_private_endpoint_connection( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -917,10 +991,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_private_endpoint_connections( @@ -944,6 +1017,8 @@ def list_private_endpoint_connections( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -956,6 +1031,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) @@ -967,6 +1043,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -984,7 +1061,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]: @@ -997,4 +1078,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_encryption_sets_operations.py index a3ecc8360581..15b300a37ee8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -130,8 +135,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -167,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -193,6 +200,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,7 +230,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -254,8 +266,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,6 +280,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -291,10 +305,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async async def get( @@ -322,17 +335,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -346,10 +366,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -361,17 +381,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -381,11 +408,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -411,7 +438,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -422,6 +450,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -442,10 +471,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -464,6 +492,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -475,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -485,6 +516,7 @@ def prepare_request(next_link=None): 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) @@ -502,7 +534,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]: @@ -515,7 +551,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -531,6 +567,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -541,6 +579,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -550,6 +589,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -567,7 +607,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]: @@ -580,7 +624,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -603,6 +647,8 @@ def list_associated_resources( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -615,6 +661,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -626,6 +673,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -643,7 +691,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]: @@ -656,4 +708,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_restore_point_operations.py index 8d9ca551895a..430e9a8b4aa8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disk_restore_point_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -83,6 +82,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -90,12 +91,17 @@ async def get( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_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) - 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]: @@ -109,7 +115,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}"} # type: ignore @distributed_trace @@ -139,6 +145,8 @@ def list_by_restore_point( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -152,6 +160,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=self.list_by_restore_point.metadata['url'], ) request = _convert_request(request) @@ -164,6 +173,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -181,7 +191,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]: @@ -194,7 +208,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + list_by_restore_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints"} # type: ignore async def _grant_access_initial( self, @@ -211,6 +225,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -221,6 +236,7 @@ async def _grant_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -228,7 +244,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -244,7 +264,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -288,8 +308,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -303,6 +324,7 @@ async def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -327,12 +349,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -346,6 +367,8 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, @@ -353,12 +376,17 @@ async def _revoke_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -368,11 +396,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -407,7 +435,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -420,6 +449,7 @@ async def begin_revoke_access( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -440,7 +470,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disks_operations.py index 942ec935fcbe..c45574bfa8c0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_images_operations.py index d4f1a63ef8e5..56e3b0005d45 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_log_analytics_operations.py index 633f84cb82fe..b5609670eb79 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_operations.py index c3815f34e230..12ae6914ebd3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_proximity_placement_groups_operations.py index 47c7e71190f5..d4001c5d19fe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -230,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) @@ -243,18 +261,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -268,7 +293,7 @@ async def get( 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 @@ -285,6 +310,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -295,6 +322,7 @@ def prepare_request(next_link=None): 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) @@ -304,6 +332,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -321,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]: @@ -334,7 +367,7 @@ async def get_next(next_link=None): 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( @@ -353,6 +386,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +399,7 @@ def prepare_request(next_link=None): 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) @@ -374,6 +410,7 @@ def prepare_request(next_link=None): 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) @@ -391,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]: @@ -404,4 +445,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_snapshots_operations.py index b27991501e8c..a95822bbc15c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_ssh_public_keys_operations.py index 5414c487621b..8d2779444cb1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -71,6 +72,7 @@ def prepare_request(next_link=None): 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) @@ -80,6 +82,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -97,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]: @@ -110,7 +117,7 @@ async def get_next(next_link=None): 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( @@ -130,6 +137,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -141,6 +150,7 @@ def prepare_request(next_link=None): 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) @@ -151,6 +161,7 @@ def prepare_request(next_link=None): 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) @@ -168,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]: @@ -181,7 +196,7 @@ async def get_next(next_link=None): 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( @@ -210,6 +225,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -218,6 +234,7 @@ async def create( 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'], @@ -225,7 +242,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -243,7 +264,7 @@ async def create( 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 @@ -273,6 +294,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -281,6 +303,7 @@ async def update( 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'], @@ -288,7 +311,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +329,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -329,17 +356,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -349,7 +383,7 @@ 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 @@ -376,17 +410,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -400,7 +441,7 @@ async def get( 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 @@ -429,17 +470,24 @@ async def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -453,5 +501,5 @@ async def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_usage_operations.py index 0dd754d319cb..56d1f16f9a82 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extension_images_operations.py index 825b91587d0f..171c401316c7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extensions_operations.py index 6608629bfbf3..b59a493eecc6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_edge_zone_operations.py index 1c7e0ae3d200..5f8ea9b25bac 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_edge_zone_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -80,6 +79,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( location=location, @@ -89,12 +90,17 @@ async def get( 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(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,7 +114,7 @@ async def get( 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 @@ -137,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) @@ -155,6 +162,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_list_request( location=location, @@ -163,6 +172,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -171,7 +181,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -185,7 +199,7 @@ async def list( 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 @@ -216,18 +230,25 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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]: @@ -241,7 +262,7 @@ async def list_offers( 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 @@ -268,17 +289,24 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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,7 +320,7 @@ async def list_publishers( 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 @@ -326,6 +354,8 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_list_skus_request( location=location, @@ -333,12 +363,17 @@ async def list_skus( 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(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]: @@ -352,5 +387,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_operations.py index e828376d4ee8..08894cc64d1e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_run_commands_operations.py index 03daf2849247..4734b929d46e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -65,6 +64,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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( @@ -142,17 +149,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -166,7 +180,7 @@ async def get( 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( @@ -175,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"] @@ -183,7 +199,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -192,6 +208,7 @@ async def _create_or_update_initial( 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'], @@ -199,7 +216,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -217,7 +238,7 @@ async def _create_or_update_initial( 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 @@ -227,6 +248,8 @@ async def begin_create_or_update( 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. @@ -240,6 +263,9 @@ 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.v2020_12_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 @@ -254,8 +280,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -269,6 +295,7 @@ async def begin_create_or_update( 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 ) @@ -292,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore async def _update_initial( self, @@ -303,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"] @@ -311,7 +339,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -320,6 +348,7 @@ async def _update_initial( 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'], @@ -327,7 +356,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,7 +374,7 @@ async def _update_initial( 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 @@ -351,6 +384,8 @@ async def begin_update( 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. @@ -363,6 +398,9 @@ 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.v2020_12_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 @@ -377,8 +415,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -392,6 +430,7 @@ async def begin_update( 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 ) @@ -415,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -433,18 +471,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -454,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -485,7 +530,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -497,6 +543,7 @@ 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 ) @@ -517,10 +564,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) + 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 + 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( @@ -539,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) @@ -552,19 +598,26 @@ async def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -578,7 +631,7 @@ async def get_by_virtual_machine( 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 @@ -595,7 +648,7 @@ 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 @@ -604,6 +657,8 @@ def list_by_virtual_machine( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -616,6 +671,7 @@ def prepare_request(next_link=None): 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'], ) @@ -628,6 +684,7 @@ def prepare_request(next_link=None): 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, ) @@ -646,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]: @@ -659,4 +720,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index c04b3f34716c..016a68c70b9a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore async def _update_initial( self, @@ -192,6 +198,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -201,6 +208,7 @@ async def _update_initial( 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'], @@ -208,7 +216,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -264,8 +276,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,6 +291,7 @@ 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 @@ -302,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -320,18 +333,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -341,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -372,7 +392,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -384,6 +405,7 @@ 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 ) @@ -404,10 +426,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -426,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) @@ -439,19 +460,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -465,7 +493,7 @@ async def get( 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 @@ -488,6 +516,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -500,6 +530,7 @@ def prepare_request(next_link=None): 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) @@ -511,6 +542,7 @@ def prepare_request(next_link=None): 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) @@ -528,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]: @@ -541,4 +577,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 05324b6b6011..ca8dba02cc76 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,12 +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) + 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 + 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, @@ -252,17 +267,24 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -272,11 +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 @distributed_trace_async - async def begin_start_extension_upgrade( + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -302,7 +324,8 @@ async def begin_start_extension_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,6 +336,7 @@ 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 ) @@ -333,10 +357,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) + 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 + 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( @@ -362,17 +385,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -386,5 +416,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 7481c5208308..237ccbb5c279 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -152,6 +158,7 @@ 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 @@ -176,10 +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) + 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 + 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, @@ -196,6 +202,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') @@ -206,6 +213,7 @@ async def _update_initial( 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'], @@ -213,7 +221,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +239,7 @@ async def _update_initial( 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 @@ -268,8 +280,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,6 +296,7 @@ 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 @@ -307,12 +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) + 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 + 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, @@ -326,6 +339,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -333,12 +348,17 @@ async def _delete_initial( 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) - 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]: @@ -348,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -382,7 +402,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,6 +416,7 @@ 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 ) @@ -415,10 +437,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) + 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 + 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( @@ -440,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) @@ -453,6 +474,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -460,13 +483,18 @@ async def get( 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) - 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]: @@ -480,7 +508,7 @@ async def get( 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 @@ -500,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) @@ -513,19 +541,26 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -539,5 +574,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 6f3eddf67a98..e79fe3fec27a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -55,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"] @@ -63,7 +64,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -73,6 +74,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +82,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -98,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -109,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. @@ -123,6 +131,9 @@ 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.v2020_12_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 @@ -137,8 +148,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -153,6 +164,7 @@ async def begin_create_or_update( 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 ) @@ -176,10 +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) + 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 + 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, @@ -188,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"] @@ -196,7 +209,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -206,6 +219,7 @@ async def _update_initial( 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'], @@ -213,7 +227,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +245,7 @@ async def _update_initial( 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 @@ -238,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. @@ -252,6 +272,9 @@ 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.v2020_12_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 @@ -266,8 +289,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -282,6 +305,7 @@ async def begin_update( 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 ) @@ -305,12 +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) + 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 + 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, @@ -324,6 +347,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -331,12 +356,17 @@ async def _delete_initial( 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) - 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]: @@ -346,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -380,7 +410,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,6 +424,7 @@ 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 ) @@ -413,10 +445,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) + 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 + 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( @@ -438,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) @@ -451,6 +482,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -458,13 +491,18 @@ async def get( 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) - 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]: @@ -478,7 +516,7 @@ async def get( 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 @@ -498,7 +536,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -507,6 +545,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -520,6 +560,7 @@ def prepare_request(next_link=None): 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'], ) @@ -533,6 +574,7 @@ def prepare_request(next_link=None): 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, ) @@ -551,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]: @@ -564,4 +610,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index b79802a82eda..c9d72398a35c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -62,6 +61,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -74,6 +74,7 @@ async def _reimage_initial( 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'], @@ -81,7 +82,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -112,6 +117,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -126,8 +132,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +147,7 @@ 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 @@ -161,12 +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) + 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 + 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, @@ -179,18 +186,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -200,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -232,7 +246,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -244,6 +259,7 @@ 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 ) @@ -264,12 +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) + 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 + 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, @@ -282,18 +297,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -303,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,7 +358,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -348,6 +371,7 @@ 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 ) @@ -368,10 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -387,6 +410,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -396,6 +420,7 @@ async def _update_initial( 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'], @@ -403,7 +428,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -421,7 +450,7 @@ async def _update_initial( 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 @@ -458,8 +487,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +502,7 @@ 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 @@ -496,12 +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) + 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 + 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, @@ -515,19 +545,26 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -537,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -558,7 +595,7 @@ 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. @@ -572,7 +609,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -585,6 +623,7 @@ 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 ) @@ -605,10 +644,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -627,8 +665,8 @@ async def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. :type instance_id: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -641,19 +679,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -667,7 +712,7 @@ async def get( 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 @@ -697,18 +742,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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,7 +774,7 @@ async def get_instance_view( 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 @@ -743,12 +795,13 @@ 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 @@ -757,6 +810,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -769,6 +824,7 @@ def prepare_request(next_link=None): 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, @@ -783,6 +839,7 @@ def prepare_request(next_link=None): 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, @@ -803,7 +860,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]: @@ -816,9 +877,9 @@ async def get_next(next_link=None): 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, @@ -832,19 +893,26 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -854,11 +922,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -878,7 +946,7 @@ 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. @@ -892,7 +960,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -905,6 +974,7 @@ 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 ) @@ -925,12 +995,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -943,18 +1012,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -964,11 +1040,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -995,7 +1071,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1007,6 +1084,7 @@ 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 ) @@ -1027,12 +1105,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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1045,18 +1122,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1066,11 +1150,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1097,7 +1181,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1109,6 +1194,7 @@ 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 ) @@ -1129,12 +1215,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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1147,18 +1232,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1168,11 +1260,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1200,7 +1292,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1212,6 +1305,7 @@ 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 ) @@ -1232,10 +1326,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) + 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 + 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( @@ -1257,7 +1350,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) @@ -1270,19 +1363,26 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -1296,10 +1396,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + 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( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1312,18 +1412,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1333,11 +1440,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1364,7 +1471,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1376,6 +1484,7 @@ 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 ) @@ -1396,13 +1505,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1428,18 +1536,25 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -1449,7 +1564,7 @@ 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( @@ -1458,6 +1573,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"]] @@ -1466,7 +1583,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1475,6 +1592,7 @@ async def _run_command_initial( 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'], @@ -1482,7 +1600,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1498,7 +1620,7 @@ async def _run_command_initial( 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 @@ -1508,6 +1630,8 @@ async def begin_run_command( 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. @@ -1520,6 +1644,9 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2020_12_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 @@ -1534,8 +1661,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -1549,6 +1676,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1572,7 +1700,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_sets_operations.py index 42367da618dd..a87938166b9d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -139,6 +147,7 @@ async def _create_or_update_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'], @@ -146,7 +155,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -164,7 +177,7 @@ async def _create_or_update_initial( 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 @@ -197,8 +210,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -210,6 +224,7 @@ 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 @@ -234,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -252,6 +266,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -260,6 +275,7 @@ async def _update_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'], @@ -267,7 +283,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -281,7 +301,7 @@ async def _update_initial( 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 @@ -314,8 +334,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -327,6 +348,7 @@ 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 @@ -351,12 +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) + 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 + 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, @@ -369,18 +390,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -390,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -408,6 +436,7 @@ 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. @@ -421,7 +450,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -433,6 +463,7 @@ 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 ) @@ -453,10 +484,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -482,17 +512,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -506,10 +543,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -522,6 +559,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -533,6 +571,7 @@ async def _deallocate_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'], @@ -540,7 +579,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -550,11 +593,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -569,7 +612,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -584,8 +628,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -597,6 +642,7 @@ 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 @@ -618,12 +664,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) + 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 + 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, @@ -637,6 +682,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -645,6 +691,7 @@ async def _delete_instances_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, @@ -653,7 +700,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -663,11 +714,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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -685,7 +736,7 @@ async def begin_delete_instances( :type vm_instance_i_ds: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs :param force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). + 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. @@ -699,8 +750,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -713,6 +765,7 @@ 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 @@ -734,10 +787,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) + 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 + 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( @@ -763,17 +815,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -787,7 +846,7 @@ async def get_instance_view( 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 @@ -807,6 +866,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -818,6 +879,7 @@ def prepare_request(next_link=None): 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) @@ -828,6 +890,7 @@ def prepare_request(next_link=None): 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) @@ -845,7 +908,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]: @@ -858,7 +925,7 @@ async def get_next(next_link=None): 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( @@ -876,6 +943,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -886,6 +955,7 @@ def prepare_request(next_link=None): 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) @@ -895,6 +965,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -912,7 +983,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]: @@ -925,7 +1000,7 @@ async def get_next(next_link=None): 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( @@ -948,6 +1023,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -960,6 +1037,7 @@ def prepare_request(next_link=None): 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) @@ -971,6 +1049,7 @@ def prepare_request(next_link=None): 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) @@ -988,7 +1067,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]: @@ -1001,7 +1084,7 @@ async def get_next(next_link=None): 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( @@ -1023,6 +1106,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1035,6 +1120,7 @@ def prepare_request(next_link=None): 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) @@ -1046,6 +1132,7 @@ def prepare_request(next_link=None): 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) @@ -1063,7 +1150,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]: @@ -1076,9 +1167,9 @@ async def get_next(next_link=None): 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, @@ -1092,6 +1183,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1103,6 +1195,7 @@ async def _power_off_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, @@ -1111,7 +1204,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1121,11 +1218,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1143,9 +1240,10 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1160,8 +1258,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1174,6 +1273,7 @@ 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 @@ -1195,12 +1295,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) + 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 + 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, @@ -1213,6 +1312,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1224,6 +1324,7 @@ async def _restart_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'], @@ -1231,7 +1332,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1241,11 +1346,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1258,7 +1363,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1273,8 +1379,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1286,6 +1393,7 @@ 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 @@ -1307,12 +1415,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) + 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 + 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, @@ -1325,6 +1432,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1336,6 +1444,7 @@ async def _start_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'], @@ -1343,7 +1452,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1353,11 +1466,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1370,7 +1483,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1385,8 +1499,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1398,6 +1513,7 @@ 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 @@ -1419,12 +1535,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) + 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 + 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, @@ -1437,6 +1552,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1448,6 +1564,7 @@ async def _redeploy_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'], @@ -1455,7 +1572,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1465,11 +1586,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1483,7 +1604,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1498,8 +1620,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1511,6 +1634,7 @@ 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 @@ -1532,12 +1656,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1550,6 +1673,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1561,6 +1685,7 @@ async def _perform_maintenance_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'], @@ -1568,7 +1693,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1578,11 +1707,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1598,7 +1727,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1613,8 +1743,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1626,6 +1757,7 @@ 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 @@ -1647,12 +1779,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1665,6 +1796,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1673,6 +1805,7 @@ async def _update_instances_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'], @@ -1680,7 +1813,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1690,11 +1827,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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1722,8 +1859,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1735,6 +1873,7 @@ 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 @@ -1756,12 +1895,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) + 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 + 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, @@ -1774,6 +1912,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -1785,6 +1924,7 @@ async def _reimage_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'], @@ -1792,7 +1932,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1802,11 +1946,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1821,7 +1965,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -1836,8 +1980,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1849,6 +1994,7 @@ 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 @@ -1870,12 +2016,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1888,6 +2033,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1899,6 +2045,7 @@ async def _reimage_all_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'], @@ -1906,7 +2053,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1916,11 +2067,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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1934,7 +2085,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1949,8 +2101,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1962,6 +2115,7 @@ 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 @@ -1983,10 +2137,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) + 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 + 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( @@ -2017,18 +2170,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -2042,11 +2202,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + async def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2073,6 +2233,7 @@ async def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2081,6 +2242,7 @@ async def convert_to_single_placement_group( 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'], @@ -2088,7 +2250,11 @@ async def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2098,10 +2264,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, @@ -2114,6 +2280,7 @@ async def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -2122,6 +2289,7 @@ async def _set_orchestration_service_state_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'], @@ -2129,7 +2297,11 @@ async def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2139,11 +2311,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 @distributed_trace_async - async def begin_set_orchestration_service_state( + async def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2170,8 +2342,9 @@ async def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2183,6 +2356,7 @@ 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 @@ -2204,7 +2378,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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_sizes_operations.py index 17401b1825fb..37a5f2103b19 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -64,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -85,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -102,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]: @@ -115,4 +121,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machines_operations.py index e262acdf96b6..35f7ea34ca8d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -318,8 +338,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,6 +352,7 @@ 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 @@ -355,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -373,6 +394,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -381,6 +403,7 @@ async def _update_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'], @@ -388,7 +411,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -402,7 +429,7 @@ async def _update_initial( 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 @@ -435,8 +462,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -448,6 +476,7 @@ 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 @@ -472,12 +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) + 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 + 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, @@ -490,18 +518,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -511,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -528,7 +563,8 @@ 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. @@ -542,7 +578,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -554,6 +591,7 @@ 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 ) @@ -574,10 +612,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -593,8 +630,8 @@ async def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -607,18 +644,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -632,7 +676,7 @@ async def get( 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 @@ -659,17 +703,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -683,10 +734,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -698,17 +749,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -718,11 +776,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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -747,7 +805,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -758,6 +817,7 @@ 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 ) @@ -778,12 +838,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) + 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 + 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, @@ -795,17 +854,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -815,11 +881,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -844,7 +910,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -855,6 +922,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -875,13 +943,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -909,17 +976,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -929,7 +1003,7 @@ 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 @@ -950,6 +1024,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -961,6 +1037,7 @@ def prepare_request(next_link=None): 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) @@ -971,6 +1048,7 @@ def prepare_request(next_link=None): 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) @@ -988,7 +1066,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]: @@ -1001,7 +1083,7 @@ async def get_next(next_link=None): 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( @@ -1013,7 +1095,7 @@ 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 @@ -1022,6 +1104,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1032,6 +1116,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1042,6 +1127,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1060,7 +1146,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]: @@ -1073,7 +1163,7 @@ async def get_next(next_link=None): 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( @@ -1096,6 +1186,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1108,6 +1200,7 @@ def prepare_request(next_link=None): 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) @@ -1119,6 +1212,7 @@ def prepare_request(next_link=None): 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) @@ -1136,7 +1230,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]: @@ -1149,9 +1247,9 @@ async def get_next(next_link=None): 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, @@ -1164,18 +1262,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -1185,11 +1290,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1205,7 +1310,7 @@ 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. @@ -1219,7 +1324,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1231,6 +1337,7 @@ 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 ) @@ -1251,12 +1358,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _reapply_initial( + async def _reapply_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1268,17 +1374,24 @@ async def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -1288,11 +1401,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 @distributed_trace_async - async def begin_reapply( + async def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1316,7 +1429,8 @@ async def begin_reapply( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1327,6 +1441,7 @@ 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 ) @@ -1347,12 +1462,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) + 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 + begin_reapply.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1364,17 +1478,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -1384,11 +1505,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1412,7 +1533,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1423,6 +1545,7 @@ 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 ) @@ -1443,12 +1566,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) + 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 + 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, @@ -1460,17 +1582,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -1480,11 +1609,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1508,7 +1637,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1519,6 +1649,7 @@ 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 ) @@ -1539,12 +1670,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) + 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 + 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, @@ -1556,17 +1686,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -1576,11 +1713,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1604,7 +1741,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1615,6 +1753,7 @@ 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 ) @@ -1635,12 +1774,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) + 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 + 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, @@ -1653,6 +1791,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1664,6 +1803,7 @@ async def _reimage_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'], @@ -1671,7 +1811,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1681,11 +1825,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1698,7 +1842,8 @@ 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.v2020_12_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1712,8 +1857,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1725,6 +1871,7 @@ 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 @@ -1746,10 +1893,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) + 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 + 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( @@ -1767,7 +1913,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) @@ -1780,18 +1926,25 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -1805,10 +1958,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1820,17 +1973,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -1840,11 +2000,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1868,7 +2028,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1879,6 +2040,7 @@ 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 ) @@ -1899,13 +2061,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1928,17 +2089,24 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -1948,7 +2116,7 @@ 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( @@ -1963,17 +2131,24 @@ async def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -1989,7 +2164,7 @@ async def _assess_patches_initial( 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 @@ -2019,7 +2194,8 @@ async def begin_assess_patches( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -2030,6 +2206,7 @@ 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 ) @@ -2053,10 +2230,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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore async def _install_patches_initial( self, @@ -2071,6 +2247,7 @@ async def _install_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') @@ -2079,6 +2256,7 @@ async def _install_patches_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'], @@ -2086,7 +2264,11 @@ async def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2102,7 +2284,7 @@ async def _install_patches_initial( 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 @@ -2136,8 +2318,9 @@ async def begin_install_patches( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineInstallPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2149,6 +2332,7 @@ 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 @@ -2173,16 +2357,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) + 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 + 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"]] @@ -2191,7 +2376,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2199,6 +2384,7 @@ async def _run_command_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'], @@ -2206,7 +2392,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2222,7 +2412,7 @@ async def _run_command_initial( 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 @@ -2231,6 +2421,8 @@ async def begin_run_command( 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. @@ -2241,6 +2433,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2020_12_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 @@ -2255,8 +2450,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2020_12_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -2269,6 +2464,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2292,7 +2488,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_compute_management_client_enums.py index 25eb0fe95cc9..33c0ea1c2e2f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_compute_management_client_enums.py @@ -313,7 +313,6 @@ class OrchestrationServiceNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enu """ AUTOMATIC_REPAIRS = "AutomaticRepairs" - DUMMY_ORCHESTRATION_SERVICE_NAME = "DummyOrchestrationServiceName" class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_models_py3.py index a98c208db947..2c0a20d00b61 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/models/_models_py3.py @@ -5140,7 +5140,7 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2020_12_01.models.OrchestrationServiceNames :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". @@ -5166,7 +5166,7 @@ def __init__( ): """ :keyword service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :paramtype service_name: str or ~azure.mgmt.compute.v2020_12_01.models.OrchestrationServiceNames :keyword action: Required. The action to be performed. Possible values include: "Resume", @@ -5184,8 +5184,7 @@ class OrchestrationServiceSummary(msrest.serialization.Model): 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". + :ivar service_name: The name of the service. Possible values include: "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2020_12_01.models.OrchestrationServiceNames :ivar service_state: The current state of the service. Possible values include: "NotRunning", "Running", "Suspended". diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_availability_sets_operations.py index 9791e753334f..d2f9caf85b2c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -185,31 +187,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -253,31 +257,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,6 +335,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -338,6 +344,7 @@ def create_or_update( 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'], @@ -345,7 +352,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -359,7 +370,7 @@ def create_or_update( 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 @@ -389,6 +400,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -397,6 +409,7 @@ def update( 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'], @@ -404,7 +417,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +435,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -445,17 +462,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -465,7 +489,7 @@ 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 @@ -492,17 +516,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -516,7 +547,7 @@ def get( 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 @@ -528,7 +559,7 @@ 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 @@ -537,6 +568,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -547,6 +580,7 @@ def prepare_request(next_link=None): 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'], ) @@ -557,6 +591,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -575,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]: @@ -588,7 +627,7 @@ def get_next(next_link=None): 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( @@ -607,6 +646,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -618,6 +659,7 @@ def prepare_request(next_link=None): 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) @@ -628,6 +670,7 @@ def prepare_request(next_link=None): 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) @@ -645,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]: @@ -658,7 +705,7 @@ def get_next(next_link=None): 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( @@ -681,6 +728,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_host_groups_operations.py index ec8b859913dc..2c4edf2db6a5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -188,30 +190,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -220,29 +223,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -297,6 +301,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -305,6 +310,7 @@ def create_or_update( 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'], @@ -312,7 +318,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -330,7 +340,7 @@ def create_or_update( 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 @@ -360,6 +370,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -368,6 +379,7 @@ def update( 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'], @@ -375,7 +387,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -389,11 +405,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -416,17 +432,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -436,7 +459,7 @@ 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 @@ -454,8 +477,8 @@ def get( :param host_group_name: The name of the dedicated host group. :type host_group_name: str :param expand: The expand expression to apply on the operation. The response shows the list of - instance view of the dedicated hosts under the dedicated host group. The default value is - "instanceView". + instance view of the dedicated hosts under the dedicated host group. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -468,18 +491,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -493,7 +523,7 @@ def get( 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 @@ -514,6 +544,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -525,6 +557,7 @@ def prepare_request(next_link=None): 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) @@ -535,6 +568,7 @@ def prepare_request(next_link=None): 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) @@ -552,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]: @@ -565,7 +603,7 @@ def get_next(next_link=None): 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( @@ -582,6 +620,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -592,6 +632,7 @@ def prepare_request(next_link=None): 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) @@ -601,6 +642,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -618,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]: @@ -631,4 +677,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_hosts_operations.py index 699e08f144a0..a0913c8d8ee2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_by_host_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -332,8 +341,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -346,6 +356,7 @@ 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 @@ -370,10 +381,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore def _update_initial( self, @@ -389,6 +399,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -398,6 +409,7 @@ def _update_initial( 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'], @@ -405,7 +417,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,7 +435,7 @@ def _update_initial( 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 @@ -454,8 +470,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,6 +485,7 @@ 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 @@ -492,12 +510,11 @@ 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) + 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 + 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: str, host_group_name: str, @@ -510,18 +527,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -531,11 +555,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -562,7 +586,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -574,6 +599,7 @@ 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 ) @@ -594,10 +620,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace def get( @@ -616,8 +641,8 @@ def get( :type host_group_name: str :param host_name: The name of the dedicated host. :type host_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -630,19 +655,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -656,7 +688,7 @@ def get( 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 @@ -680,6 +712,8 @@ def list_by_host_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -692,6 +726,7 @@ def prepare_request(next_link=None): 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) @@ -703,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -720,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]: @@ -733,4 +773,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_accesses_operations.py index dcd556f6483b..a5e09f0e3bb2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_get_private_link_resources_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -296,12 +301,12 @@ def build_update_a_private_endpoint_connection_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -309,23 +314,23 @@ def build_update_a_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -339,10 +344,11 @@ def build_get_a_private_endpoint_connection_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -350,21 +356,21 @@ def build_get_a_private_endpoint_connection_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -376,10 +382,11 @@ def build_delete_a_private_endpoint_connection_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -387,21 +394,21 @@ def build_delete_a_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -412,31 +419,32 @@ def build_list_private_endpoint_connections_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -475,6 +483,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -483,6 +492,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -490,7 +500,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -508,7 +522,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -541,8 +555,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -554,6 +569,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -578,10 +594,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore def _update_initial( self, @@ -596,6 +611,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -604,6 +620,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -611,7 +628,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -629,7 +650,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -662,8 +683,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -675,6 +697,7 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -699,10 +722,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def get( @@ -730,17 +752,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -754,10 +783,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -769,17 +798,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -789,11 +825,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -819,7 +855,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -830,6 +867,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -850,10 +888,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -870,6 +907,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -881,6 +920,7 @@ def prepare_request(next_link=None): 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) @@ -891,6 +931,7 @@ def prepare_request(next_link=None): 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) @@ -908,7 +949,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]: @@ -921,7 +966,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -935,6 +980,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -945,6 +992,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -954,6 +1002,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -971,7 +1020,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]: @@ -984,7 +1037,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def get_private_link_resources( @@ -1012,17 +1065,24 @@ def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1036,7 +1096,7 @@ def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore def _update_a_private_endpoint_connection_initial( @@ -1053,6 +1113,7 @@ def _update_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -1062,6 +1123,7 @@ def _update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], @@ -1069,7 +1131,11 @@ def _update_a_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1087,7 +1153,7 @@ def _update_a_private_endpoint_connection_initial( return deserialized - _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace @@ -1128,8 +1194,9 @@ def begin_update_a_private_endpoint_connection( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -1142,6 +1209,7 @@ def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1166,10 +1234,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_update_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def get_a_private_endpoint_connection( @@ -1200,18 +1267,25 @@ def get_a_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_a_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_a_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1225,10 +1299,10 @@ def get_a_private_endpoint_connection( return deserialized - get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - def _delete_a_private_endpoint_connection_initial( + def _delete_a_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -1241,18 +1315,25 @@ def _delete_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_a_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1262,11 +1343,11 @@ def _delete_a_private_endpoint_connection_initial( if cls: return cls(pipeline_response, None, {}) - _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete_a_private_endpoint_connection( + def begin_delete_a_private_endpoint_connection( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -1295,7 +1376,8 @@ def begin_delete_a_private_endpoint_connection( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,6 +1389,7 @@ def begin_delete_a_private_endpoint_connection( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1327,10 +1410,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_private_endpoint_connections( @@ -1354,6 +1436,8 @@ def list_private_endpoint_connections( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1366,6 +1450,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) @@ -1377,6 +1462,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1394,7 +1480,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]: @@ -1407,4 +1497,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_encryption_sets_operations.py index d164eead1041..64b29979d9b1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_list_associated_resources_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -320,6 +325,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -328,6 +334,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -335,7 +342,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -353,7 +364,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -388,8 +399,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -401,6 +413,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -425,10 +438,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore def _update_initial( self, @@ -443,6 +455,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -451,6 +464,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -458,7 +472,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -476,7 +494,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -511,8 +529,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -524,6 +543,7 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -548,10 +568,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def get( @@ -579,17 +598,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -603,10 +629,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -618,17 +644,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -638,11 +671,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -668,7 +701,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -679,6 +713,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -699,10 +734,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -721,6 +755,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -732,6 +768,7 @@ def prepare_request(next_link=None): 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) @@ -742,6 +779,7 @@ def prepare_request(next_link=None): 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) @@ -759,7 +797,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]: @@ -772,7 +814,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -788,6 +830,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -798,6 +842,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -807,6 +852,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -824,7 +870,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]: @@ -837,7 +887,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -859,6 +909,8 @@ def list_associated_resources( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -871,6 +923,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -882,6 +935,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -899,7 +953,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]: @@ -912,4 +970,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_restore_point_operations.py index 80fc175aba3b..3322a73274c2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disk_restore_point_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( disk_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}") # 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'), @@ -49,21 +50,21 @@ def build_get_request( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -75,10 +76,11 @@ def build_list_by_restore_point_request( vm_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints") # 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'), @@ -86,21 +88,21 @@ def build_list_by_restore_point_request( "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -116,12 +118,12 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess") # 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'), @@ -130,23 +132,23 @@ def build_grant_access_request_initial( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -161,10 +163,11 @@ def build_revoke_access_request_initial( disk_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess") # 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'), @@ -173,21 +176,21 @@ def build_revoke_access_request_initial( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -248,6 +251,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -255,12 +260,17 @@ def get( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_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) - 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]: @@ -274,7 +284,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}"} # type: ignore @distributed_trace @@ -304,6 +314,8 @@ def list_by_restore_point( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -317,6 +329,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=self.list_by_restore_point.metadata['url'], ) request = _convert_request(request) @@ -329,6 +342,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -346,7 +360,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]: @@ -359,7 +377,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + list_by_restore_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints"} # type: ignore def _grant_access_initial( self, @@ -376,6 +394,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -386,6 +405,7 @@ def _grant_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -393,7 +413,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -409,7 +433,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore @distributed_trace @@ -452,8 +476,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -467,6 +492,7 @@ def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -491,12 +517,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -510,6 +535,8 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, @@ -517,12 +544,17 @@ def _revoke_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -532,11 +564,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -571,7 +603,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -584,6 +617,7 @@ def begin_revoke_access( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -604,7 +638,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disks_operations.py index ff6b412d4813..74234baa3f42 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_images_operations.py index f12803c8400e..83cb4bba0c3e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -154,33 +155,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -291,6 +296,7 @@ def _create_or_update_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'], @@ -298,7 +304,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -316,7 +326,7 @@ def _create_or_update_initial( 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 @@ -347,8 +357,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -360,6 +371,7 @@ 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 @@ -384,10 +396,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -402,6 +413,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -410,6 +422,7 @@ def _update_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'], @@ -417,7 +430,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -435,7 +452,7 @@ def _update_initial( 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 @@ -466,8 +483,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +497,7 @@ 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 @@ -503,12 +522,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -520,17 +538,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -540,11 +565,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -568,7 +593,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,6 +605,7 @@ 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 ) @@ -599,10 +626,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -618,7 +644,7 @@ 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) @@ -631,18 +657,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -656,7 +689,7 @@ def get( 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 @@ -674,6 +707,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -685,6 +720,7 @@ def prepare_request(next_link=None): 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) @@ -695,6 +731,7 @@ def prepare_request(next_link=None): 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) @@ -712,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]: @@ -725,7 +766,7 @@ def get_next(next_link=None): 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( @@ -740,6 +781,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -750,6 +793,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -759,6 +803,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -776,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]: @@ -789,4 +838,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_log_analytics_operations.py index 1e07ed584d4a..9f5795911db3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_operations.py index 48dda8378dbf..eb0d2517c447 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_proximity_placement_groups_operations.py index e73354414a56..dc1c6be7d190 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( include_colocation_status: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -187,29 +189,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -295,6 +299,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -303,6 +308,7 @@ def create_or_update( 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'], @@ -310,7 +316,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -328,7 +338,7 @@ def create_or_update( 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 @@ -358,6 +368,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -366,6 +377,7 @@ def update( 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'], @@ -373,7 +385,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -387,11 +403,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -414,17 +430,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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,7 +457,7 @@ 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 @@ -452,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) @@ -465,18 +488,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -490,7 +520,7 @@ def get( 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 @@ -507,6 +537,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -517,6 +549,7 @@ def prepare_request(next_link=None): 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) @@ -526,6 +559,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -543,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]: @@ -556,7 +594,7 @@ def get_next(next_link=None): 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( @@ -575,6 +613,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -586,6 +626,7 @@ def prepare_request(next_link=None): 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) @@ -596,6 +637,7 @@ def prepare_request(next_link=None): 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) @@ -613,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]: @@ -626,4 +672,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py index ddcb0be905f3..50fc452c69da 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_ssh_public_keys_operations.py index 101e71ae7c32..230d5147b69c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,30 +64,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -100,35 +102,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -144,35 +146,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -185,25 +187,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -214,31 +217,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -249,31 +253,32 @@ def build_generate_key_pair_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -314,6 +319,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -324,6 +331,7 @@ def prepare_request(next_link=None): 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) @@ -333,6 +341,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -350,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]: @@ -363,7 +376,7 @@ def get_next(next_link=None): 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( @@ -383,6 +396,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -394,6 +409,7 @@ def prepare_request(next_link=None): 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) @@ -404,6 +420,7 @@ def prepare_request(next_link=None): 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) @@ -421,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]: @@ -434,7 +455,7 @@ def get_next(next_link=None): 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( @@ -463,6 +484,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -471,6 +493,7 @@ def create( 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'], @@ -478,7 +501,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def create( 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 @@ -526,6 +553,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -534,6 +562,7 @@ def update( 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'], @@ -541,7 +570,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -555,11 +588,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -582,17 +615,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -602,7 +642,7 @@ 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 @@ -629,17 +669,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -653,7 +700,7 @@ def get( 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 @@ -682,17 +729,24 @@ def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -706,5 +760,5 @@ def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_usage_operations.py index 9d1ea4b227ee..aeefd7e9ed3e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extension_images_operations.py index ec62a22036ca..c6c6d5568667 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extensions_operations.py index 5314aeee6636..ecf055e6430a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,9 +127,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -137,16 +138,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -160,10 +161,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -171,23 +173,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -200,33 +202,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,6 +269,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -275,6 +279,7 @@ def _create_or_update_initial( 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'], @@ -282,7 +287,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -300,7 +309,7 @@ def _create_or_update_initial( 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 @@ -338,8 +347,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,6 +362,7 @@ 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 @@ -376,10 +387,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -395,6 +405,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -404,6 +415,7 @@ def _update_initial( 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'], @@ -411,7 +423,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -425,7 +441,7 @@ def _update_initial( 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 @@ -463,8 +479,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,6 +494,7 @@ 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 @@ -501,12 +519,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -519,18 +536,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -540,11 +564,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -571,7 +595,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -583,6 +608,7 @@ 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 ) @@ -603,10 +629,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -625,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) @@ -638,19 +663,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -664,7 +696,7 @@ def get( 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 @@ -681,7 +713,7 @@ 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) @@ -694,18 +726,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -719,5 +758,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_edge_zone_operations.py index 4c8d8aea07ef..afe8275d6e48 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_edge_zone_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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}') + _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'), @@ -49,21 +50,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -81,10 +82,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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'), @@ -94,27 +96,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -126,10 +128,11 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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'), @@ -137,21 +140,21 @@ def build_list_offers_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,31 +165,32 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,10 +203,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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'), @@ -211,21 +216,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -287,6 +292,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( location=location, @@ -296,12 +303,17 @@ def get( 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(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]: @@ -315,7 +327,7 @@ def get( 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 @@ -344,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) @@ -362,6 +375,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_list_request( location=location, @@ -370,6 +385,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -378,7 +394,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -392,7 +412,7 @@ def list( 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 @@ -423,18 +443,25 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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]: @@ -448,7 +475,7 @@ def list_offers( 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 @@ -475,17 +502,24 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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 +533,7 @@ def list_publishers( 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 @@ -533,6 +567,8 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_list_skus_request( location=location, @@ -540,12 +576,17 @@ def list_skus( 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(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]: @@ -559,5 +600,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_operations.py index a5dc8e5da228..04cfbc751888 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_run_commands_operations.py index 43479fc51e08..5f752b286e74 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,31 +69,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -107,12 +109,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -120,23 +122,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -153,12 +155,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -166,23 +168,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -196,10 +198,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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}') + _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'), @@ -207,21 +210,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -235,10 +238,11 @@ def build_get_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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}') + _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'), @@ -246,23 +250,23 @@ def build_get_by_virtual_machine_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -275,33 +279,34 @@ def build_list_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -344,6 +349,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -355,6 +362,7 @@ def prepare_request(next_link=None): 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) @@ -365,6 +373,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -382,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]: @@ -395,7 +408,7 @@ def get_next(next_link=None): 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( @@ -421,17 +434,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -445,7 +465,7 @@ def get( 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( @@ -454,6 +474,8 @@ 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"] @@ -462,7 +484,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -471,6 +493,7 @@ def _create_or_update_initial( 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'], @@ -478,7 +501,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def _create_or_update_initial( 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 @@ -506,6 +533,8 @@ def begin_create_or_update( 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. @@ -519,6 +548,9 @@ 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.v2020_12_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 @@ -533,8 +565,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -548,6 +580,7 @@ def begin_create_or_update( 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 ) @@ -571,10 +604,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore def _update_initial( self, @@ -582,6 +614,8 @@ 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"] @@ -590,7 +624,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -599,6 +633,7 @@ def _update_initial( 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'], @@ -606,7 +641,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +659,7 @@ def _update_initial( 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 @@ -630,6 +669,8 @@ def begin_update( 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. @@ -642,6 +683,9 @@ 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.v2020_12_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 @@ -656,8 +700,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -671,6 +715,7 @@ def begin_update( 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 ) @@ -694,12 +739,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -712,18 +756,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -733,11 +784,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -764,7 +815,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -776,6 +828,7 @@ 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 ) @@ -796,10 +849,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get_by_virtual_machine( @@ -818,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) @@ -831,19 +883,26 @@ def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -857,7 +916,7 @@ def get_by_virtual_machine( 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 @@ -874,7 +933,7 @@ 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 @@ -883,6 +942,8 @@ def list_by_virtual_machine( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -895,6 +956,7 @@ def prepare_request(next_link=None): 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'], ) @@ -907,6 +969,7 @@ def prepare_request(next_link=None): 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, ) @@ -925,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]: @@ -938,4 +1005,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_extensions_operations.py index 6449d4c2d540..d2feeaf85765 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -336,8 +345,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -350,6 +360,7 @@ 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 @@ -374,10 +385,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore def _update_initial( self, @@ -393,6 +403,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -402,6 +413,7 @@ def _update_initial( 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'], @@ -409,7 +421,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,12 +521,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -521,18 +538,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -542,11 +566,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -573,7 +597,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -585,6 +610,7 @@ 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 ) @@ -605,10 +631,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -627,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) @@ -640,19 +665,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -666,7 +698,7 @@ def get( 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 @@ -689,6 +721,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -701,6 +735,7 @@ def prepare_request(next_link=None): 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) @@ -712,6 +747,7 @@ def prepare_request(next_link=None): 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) @@ -729,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]: @@ -742,4 +782,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index c7da3ed00a2c..af747b6d24cd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,25 +33,26 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -62,25 +63,26 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -91,25 +93,26 @@ def build_start_extension_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -120,31 +123,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -170,7 +174,7 @@ 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: str, vm_scale_set_name: str, @@ -182,17 +186,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -202,11 +213,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -230,7 +241,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -241,6 +253,7 @@ 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 ) @@ -261,12 +274,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -278,17 +290,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,11 +317,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -328,7 +347,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -339,6 +359,7 @@ 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 ) @@ -359,12 +380,11 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def _start_extension_upgrade_initial( + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -376,17 +396,24 @@ def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -396,11 +423,11 @@ 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 @distributed_trace - def begin_start_extension_upgrade( + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -426,7 +453,8 @@ def begin_start_extension_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -437,6 +465,7 @@ 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 ) @@ -457,10 +486,9 @@ 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) + 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 + begin_start_extension_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -486,17 +514,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -510,5 +545,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 09fe42a664db..c580fb394378 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -53,23 +53,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -87,12 +87,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -101,23 +101,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -132,10 +132,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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}') + _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'), @@ -144,21 +145,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -173,10 +174,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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}') + _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'), @@ -185,23 +187,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,10 +217,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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'), @@ -226,23 +229,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +286,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') @@ -293,6 +297,7 @@ def _create_or_update_initial( 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'], @@ -300,7 +305,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -359,8 +368,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -374,6 +384,7 @@ 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 @@ -398,10 +409,9 @@ 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) + 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 + 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, @@ -418,6 +428,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') @@ -428,6 +439,7 @@ def _update_initial( 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'], @@ -435,7 +447,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -449,7 +465,7 @@ def _update_initial( 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 @@ -490,8 +506,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -505,6 +522,7 @@ 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 @@ -529,12 +547,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -548,6 +565,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -555,12 +574,17 @@ def _delete_initial( 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) - 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]: @@ -570,11 +594,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -604,7 +628,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -617,6 +642,7 @@ 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 ) @@ -637,10 +663,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -662,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) @@ -675,6 +700,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -682,13 +709,18 @@ def get( 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) - 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]: @@ -702,7 +734,7 @@ def get( 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 @@ -722,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) @@ -735,19 +767,26 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -761,5 +800,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index f3111ad18c28..b254a8f8ea3a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -133,10 +133,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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}') + _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'), @@ -145,21 +146,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -174,10 +175,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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}') + _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'), @@ -186,23 +188,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -216,10 +218,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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'), @@ -227,23 +230,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -276,6 +279,8 @@ 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"] @@ -284,7 +289,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -294,6 +299,7 @@ def _create_or_update_initial( 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'], @@ -301,7 +307,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -319,7 +329,7 @@ def _create_or_update_initial( 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 @@ -330,6 +340,8 @@ def begin_create_or_update( 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. @@ -344,6 +356,9 @@ 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.v2020_12_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 @@ -358,8 +373,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -374,6 +389,7 @@ def begin_create_or_update( 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 ) @@ -397,10 +413,9 @@ 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) + 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 + 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, @@ -409,6 +424,8 @@ 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"] @@ -417,7 +434,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -427,6 +444,7 @@ def _update_initial( 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'], @@ -434,7 +452,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -448,7 +470,7 @@ def _update_initial( 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 @@ -459,6 +481,8 @@ def begin_update( 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. @@ -473,6 +497,9 @@ 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.v2020_12_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 @@ -487,8 +514,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -503,6 +530,7 @@ def begin_update( 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 ) @@ -526,12 +554,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -545,6 +572,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -552,12 +581,17 @@ def _delete_initial( 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) - 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]: @@ -567,11 +601,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -601,7 +635,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -614,6 +649,7 @@ 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 ) @@ -634,10 +670,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get( @@ -659,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) @@ -672,6 +707,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -679,13 +716,18 @@ def get( 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) - 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]: @@ -699,7 +741,7 @@ def get( 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 @@ -719,7 +761,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -728,6 +770,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -741,6 +785,7 @@ def prepare_request(next_link=None): 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'], ) @@ -754,6 +799,7 @@ def prepare_request(next_link=None): 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, ) @@ -772,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]: @@ -785,4 +835,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vms_operations.py index 6e65cf2f4330..63d21ba7f65c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,11 +39,11 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -51,22 +51,22 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,9 +80,10 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -90,16 +91,16 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -111,9 +112,10 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -121,16 +123,16 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -145,12 +147,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -158,23 +160,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -190,9 +192,10 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -200,18 +203,18 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -225,10 +228,11 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -236,23 +240,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -264,10 +268,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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'), @@ -275,21 +280,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -304,37 +309,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -348,9 +354,10 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -358,18 +365,18 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -381,9 +388,10 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -391,16 +399,16 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -412,9 +420,10 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -422,16 +431,16 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -443,9 +452,10 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -453,16 +463,16 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -476,10 +486,11 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-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') + _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'), @@ -487,23 +498,23 @@ def build_retrieve_boot_diagnostics_data_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -515,9 +526,10 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -525,16 +537,16 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -546,9 +558,10 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + _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'), @@ -556,16 +569,16 @@ def build_simulate_eviction_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -580,12 +593,12 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -593,29 +606,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -637,7 +650,7 @@ 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: str, vm_scale_set_name: str, @@ -651,6 +664,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -663,6 +677,7 @@ def _reimage_initial( 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'], @@ -670,7 +685,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -680,11 +699,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -701,6 +720,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -715,8 +735,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -729,6 +750,7 @@ 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 @@ -750,12 +772,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -768,18 +789,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -789,11 +817,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -821,7 +849,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,6 +862,7 @@ 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 ) @@ -853,12 +883,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -871,18 +900,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -892,11 +928,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -925,7 +961,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -937,6 +974,7 @@ 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 ) @@ -957,10 +995,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -976,6 +1013,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -985,6 +1023,7 @@ def _update_initial( 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'], @@ -992,7 +1031,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1010,7 +1053,7 @@ def _update_initial( 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 @@ -1047,8 +1090,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -1061,6 +1105,7 @@ 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 @@ -1085,12 +1130,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1104,19 +1148,26 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -1126,11 +1177,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1147,7 +1198,7 @@ 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. @@ -1161,7 +1212,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1174,6 +1226,7 @@ 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 ) @@ -1194,10 +1247,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1216,8 +1268,8 @@ def get( :type vm_scale_set_name: str :param instance_id: The instance ID of the virtual machine. :type instance_id: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -1230,19 +1282,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -1256,7 +1315,7 @@ def get( 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 @@ -1286,18 +1345,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -1311,7 +1377,7 @@ def get_instance_view( 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 @@ -1332,12 +1398,13 @@ 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 @@ -1346,6 +1413,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1358,6 +1427,7 @@ def prepare_request(next_link=None): 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, @@ -1372,6 +1442,7 @@ def prepare_request(next_link=None): 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, @@ -1392,7 +1463,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]: @@ -1405,9 +1480,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1421,19 +1496,26 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -1443,11 +1525,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1467,7 +1549,7 @@ 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. @@ -1481,7 +1563,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1494,6 +1577,7 @@ 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 ) @@ -1514,12 +1598,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1532,18 +1615,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1553,11 +1643,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1584,7 +1674,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1596,6 +1687,7 @@ 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 ) @@ -1616,12 +1708,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1634,18 +1725,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1655,11 +1753,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1686,7 +1784,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1698,6 +1797,7 @@ 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 ) @@ -1718,12 +1818,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1736,18 +1835,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1757,11 +1863,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1789,7 +1895,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1801,6 +1908,7 @@ 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 ) @@ -1821,10 +1929,9 @@ 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) + 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 + 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( @@ -1846,7 +1953,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) @@ -1859,19 +1966,26 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-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) - 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]: @@ -1885,10 +1999,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1901,18 +2015,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1922,11 +2043,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1953,7 +2074,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1965,6 +2087,7 @@ 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 ) @@ -1985,13 +2108,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2017,18 +2139,25 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -2038,7 +2167,7 @@ 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( @@ -2047,6 +2176,8 @@ 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"]] @@ -2055,7 +2186,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2064,6 +2195,7 @@ def _run_command_initial( 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'], @@ -2071,7 +2203,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2087,7 +2223,7 @@ def _run_command_initial( 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 @@ -2097,6 +2233,8 @@ def begin_run_command( 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. @@ -2109,6 +2247,9 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2020_12_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 @@ -2122,8 +2263,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -2137,6 +2278,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2160,7 +2302,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_sets_operations.py index aa79cac9be7c..3594c0b98f85 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -158,27 +159,28 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -189,31 +191,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -227,33 +230,33 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -270,35 +273,35 @@ def build_delete_instances_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -311,31 +314,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -345,30 +349,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -377,29 +382,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -410,31 +416,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -445,31 +452,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -484,35 +492,35 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -528,33 +536,33 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -570,33 +578,33 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -612,33 +620,33 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -654,33 +662,33 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -696,33 +704,33 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -738,33 +746,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -780,33 +788,33 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -821,32 +829,33 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -860,33 +869,33 @@ def build_convert_to_single_placement_group_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -902,39 +911,39 @@ def build_set_orchestration_service_state_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -973,6 +982,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -984,6 +995,7 @@ def prepare_request(next_link=None): 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) @@ -994,6 +1006,7 @@ def prepare_request(next_link=None): 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) @@ -1011,7 +1024,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]: @@ -1024,7 +1041,7 @@ def get_next(next_link=None): 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, @@ -1039,6 +1056,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -1047,6 +1065,7 @@ def _create_or_update_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'], @@ -1054,7 +1073,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1072,7 +1095,7 @@ def _create_or_update_initial( 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 @@ -1105,8 +1128,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1118,6 +1142,7 @@ 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 @@ -1142,10 +1167,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -1160,6 +1184,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -1168,6 +1193,7 @@ def _update_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'], @@ -1175,7 +1201,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1189,7 +1219,7 @@ def _update_initial( 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 @@ -1222,8 +1252,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1235,6 +1266,7 @@ 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 @@ -1259,12 +1291,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1277,18 +1308,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1298,11 +1336,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1316,6 +1354,7 @@ 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. @@ -1329,7 +1368,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1341,6 +1381,7 @@ 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 ) @@ -1361,10 +1402,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1390,17 +1430,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1414,10 +1461,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1430,6 +1477,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1441,6 +1489,7 @@ def _deallocate_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'], @@ -1448,7 +1497,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1458,11 +1511,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1477,7 +1530,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1492,8 +1546,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1505,6 +1560,7 @@ 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 @@ -1526,12 +1582,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1545,6 +1600,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1553,6 +1609,7 @@ def _delete_instances_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, @@ -1561,7 +1618,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1571,11 +1632,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1593,7 +1654,7 @@ def begin_delete_instances( :type vm_instance_i_ds: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs :param force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). + 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. @@ -1607,8 +1668,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1621,6 +1683,7 @@ 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 @@ -1642,10 +1705,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1671,17 +1733,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -1695,7 +1764,7 @@ def get_instance_view( 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 @@ -1715,6 +1784,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1726,6 +1797,7 @@ def prepare_request(next_link=None): 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) @@ -1736,6 +1808,7 @@ def prepare_request(next_link=None): 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) @@ -1753,7 +1826,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]: @@ -1766,7 +1843,7 @@ def get_next(next_link=None): 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( @@ -1784,6 +1861,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1794,6 +1873,7 @@ def prepare_request(next_link=None): 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) @@ -1803,6 +1883,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1820,7 +1901,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]: @@ -1833,7 +1918,7 @@ def get_next(next_link=None): 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( @@ -1856,6 +1941,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1868,6 +1955,7 @@ def prepare_request(next_link=None): 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) @@ -1879,6 +1967,7 @@ def prepare_request(next_link=None): 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) @@ -1896,7 +1985,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]: @@ -1909,7 +2002,7 @@ def get_next(next_link=None): 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( @@ -1931,6 +2024,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1943,6 +2038,7 @@ def prepare_request(next_link=None): 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) @@ -1954,6 +2050,7 @@ def prepare_request(next_link=None): 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) @@ -1971,7 +2068,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]: @@ -1984,9 +2085,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -2000,6 +2101,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2011,6 +2113,7 @@ def _power_off_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, @@ -2019,7 +2122,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2029,11 +2136,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2051,9 +2158,10 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2068,8 +2176,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2082,6 +2191,7 @@ 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 @@ -2103,12 +2213,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2121,6 +2230,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2132,6 +2242,7 @@ def _restart_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'], @@ -2139,7 +2250,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2149,11 +2264,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2166,7 +2281,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2181,8 +2297,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2194,6 +2311,7 @@ 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 @@ -2215,12 +2333,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2233,6 +2350,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2244,6 +2362,7 @@ def _start_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'], @@ -2251,7 +2370,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2261,11 +2384,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2278,7 +2401,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2293,8 +2417,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2306,6 +2431,7 @@ 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 @@ -2327,12 +2453,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2345,6 +2470,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2356,6 +2482,7 @@ def _redeploy_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'], @@ -2363,7 +2490,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2373,11 +2504,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2391,7 +2522,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2406,8 +2538,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2419,6 +2552,7 @@ 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 @@ -2440,12 +2574,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2458,6 +2591,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2469,6 +2603,7 @@ def _perform_maintenance_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'], @@ -2476,7 +2611,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2486,11 +2625,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2506,7 +2645,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2521,8 +2661,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2534,6 +2675,7 @@ 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 @@ -2555,12 +2697,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2573,6 +2714,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2581,6 +2723,7 @@ def _update_instances_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'], @@ -2588,7 +2731,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2598,11 +2745,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2630,8 +2777,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2643,6 +2791,7 @@ 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 @@ -2664,12 +2813,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2682,6 +2830,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -2693,6 +2842,7 @@ def _reimage_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'], @@ -2700,7 +2850,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2710,11 +2864,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2729,7 +2883,7 @@ 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. + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2020_12_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -2744,8 +2898,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2757,6 +2912,7 @@ 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 @@ -2778,12 +2934,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2796,6 +2951,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2807,6 +2963,7 @@ def _reimage_all_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'], @@ -2814,7 +2971,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2824,11 +2985,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2842,7 +3003,8 @@ 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. + :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.v2020_12_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2857,8 +3019,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2870,6 +3033,7 @@ 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 @@ -2891,10 +3055,9 @@ 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) + 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 + 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( @@ -2925,18 +3088,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -2950,11 +3120,11 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2981,6 +3151,7 @@ def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2989,6 +3160,7 @@ def convert_to_single_placement_group( 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'], @@ -2996,7 +3168,11 @@ def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3006,10 +3182,10 @@ 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: str, vm_scale_set_name: str, @@ -3022,6 +3198,7 @@ def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -3030,6 +3207,7 @@ def _set_orchestration_service_state_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'], @@ -3037,7 +3215,11 @@ def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3047,11 +3229,11 @@ 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 @distributed_trace - def begin_set_orchestration_service_state( + def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -3078,8 +3260,9 @@ def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -3091,6 +3274,7 @@ 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 @@ -3112,7 +3296,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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_sizes_operations.py index 65063ff4f319..2395451b8735 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,6 +99,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -109,6 +112,7 @@ def prepare_request(next_link=None): 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) @@ -119,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machines_operations.py index 3c8021d48738..2e6eacc166e0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_12_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -202,27 +203,28 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -235,33 +237,34 @@ def build_get_request( expand: Optional[str] = "instanceView", **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -272,31 +275,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -307,25 +311,26 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -336,25 +341,26 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -365,25 +371,26 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -393,30 +400,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -427,31 +435,32 @@ def build_list_all_request( status_only: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -462,31 +471,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -499,27 +509,28 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -530,31 +541,32 @@ def build_reapply_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -565,25 +577,26 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -594,25 +607,26 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -623,25 +637,26 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -655,33 +670,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -696,33 +711,34 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -733,25 +749,26 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -762,25 +779,26 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -791,31 +809,32 @@ def build_assess_patches_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2020-12-01" + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -829,35 +848,35 @@ def build_install_patches_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -873,41 +892,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2020-12-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -946,6 +965,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -957,6 +978,7 @@ def prepare_request(next_link=None): 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) @@ -967,6 +989,7 @@ def prepare_request(next_link=None): 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) @@ -984,7 +1007,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]: @@ -997,7 +1024,7 @@ def get_next(next_link=None): 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, @@ -1012,6 +1039,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -1020,6 +1048,7 @@ def _capture_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'], @@ -1027,7 +1056,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1043,7 +1076,7 @@ def _capture_initial( 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 @@ -1077,8 +1110,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1090,6 +1124,7 @@ 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 @@ -1114,10 +1149,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -1132,6 +1166,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -1140,6 +1175,7 @@ def _create_or_update_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'], @@ -1147,7 +1183,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1165,7 +1205,7 @@ def _create_or_update_initial( 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 @@ -1198,8 +1238,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1211,6 +1252,7 @@ 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 @@ -1235,10 +1277,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1253,6 +1294,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1261,6 +1303,7 @@ def _update_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'], @@ -1268,7 +1311,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1282,7 +1329,7 @@ def _update_initial( 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 @@ -1314,8 +1361,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1327,6 +1375,7 @@ 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 @@ -1351,12 +1400,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1369,18 +1417,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -1390,11 +1445,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1407,7 +1462,8 @@ 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. @@ -1421,7 +1477,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1433,6 +1490,7 @@ 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 ) @@ -1453,10 +1511,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1472,8 +1529,8 @@ def get( :type resource_group_name: str :param vm_name: The name of the virtual machine. :type vm_name: str - :param expand: The expand expression to apply on the operation. The default value is - "instanceView". + :param expand: The expand expression to apply on the operation. Possible values are + "instanceView" or None. Default value is "instanceView". :type expand: str :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1486,18 +1543,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -1511,7 +1575,7 @@ def get( 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 @@ -1538,17 +1602,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -1562,10 +1633,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1577,17 +1648,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1597,11 +1675,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1626,7 +1704,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1637,6 +1716,7 @@ 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 ) @@ -1657,12 +1737,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1674,17 +1753,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1694,11 +1780,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1723,7 +1809,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1734,6 +1821,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1754,13 +1842,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1788,17 +1875,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -1808,7 +1902,7 @@ 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 @@ -1829,6 +1923,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1840,6 +1936,7 @@ def prepare_request(next_link=None): 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) @@ -1850,6 +1947,7 @@ def prepare_request(next_link=None): 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) @@ -1867,7 +1965,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]: @@ -1880,7 +1982,7 @@ def get_next(next_link=None): 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( @@ -1892,7 +1994,7 @@ 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 @@ -1901,6 +2003,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1911,6 +2015,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1921,6 +2026,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1939,7 +2045,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]: @@ -1952,7 +2062,7 @@ def get_next(next_link=None): 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( @@ -1975,6 +2085,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1987,6 +2099,7 @@ def prepare_request(next_link=None): 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) @@ -1998,6 +2111,7 @@ def prepare_request(next_link=None): 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) @@ -2015,7 +2129,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]: @@ -2028,9 +2146,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -2043,18 +2161,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -2064,11 +2189,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2084,7 +2209,7 @@ 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. @@ -2098,7 +2223,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2110,6 +2236,7 @@ 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 ) @@ -2130,12 +2257,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2147,17 +2273,24 @@ def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -2167,11 +2300,11 @@ 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 @distributed_trace - def begin_reapply( + def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2195,7 +2328,8 @@ def begin_reapply( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2206,6 +2340,7 @@ 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 ) @@ -2226,12 +2361,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2243,17 +2377,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -2263,11 +2404,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2291,7 +2432,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2302,6 +2444,7 @@ 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 ) @@ -2322,12 +2465,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2339,17 +2481,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -2359,11 +2508,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2387,7 +2536,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2398,6 +2548,7 @@ 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 ) @@ -2418,12 +2569,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2435,17 +2585,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -2455,11 +2612,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2483,7 +2640,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2494,6 +2652,7 @@ 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 ) @@ -2514,12 +2673,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2532,6 +2690,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -2543,6 +2702,7 @@ def _reimage_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'], @@ -2550,7 +2710,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2560,11 +2724,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2577,7 +2741,8 @@ 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.v2020_12_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2591,8 +2756,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2604,6 +2770,7 @@ 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 @@ -2625,10 +2792,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore @distributed_trace def retrieve_boot_diagnostics_data( @@ -2646,7 +2812,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) @@ -2659,18 +2825,25 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -2684,10 +2857,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2699,17 +2872,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -2719,11 +2899,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2747,7 +2927,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2758,6 +2939,7 @@ 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 ) @@ -2778,13 +2960,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2807,17 +2988,24 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str + 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) - 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]: @@ -2827,7 +3015,7 @@ 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( @@ -2842,17 +3030,24 @@ def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: 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) - 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]: @@ -2868,7 +3063,7 @@ def _assess_patches_initial( 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 @@ -2898,7 +3093,8 @@ def begin_assess_patches( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -2909,6 +3105,7 @@ 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 ) @@ -2932,10 +3129,9 @@ 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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore def _install_patches_initial( self, @@ -2950,6 +3146,7 @@ def _install_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') @@ -2958,6 +3155,7 @@ def _install_patches_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'], @@ -2965,7 +3163,11 @@ def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2981,7 +3183,7 @@ def _install_patches_initial( 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 @@ -3015,8 +3217,9 @@ def begin_install_patches( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.VirtualMachineInstallPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -3028,6 +3231,7 @@ 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 @@ -3052,16 +3256,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) + 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 + 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: 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"]] @@ -3070,7 +3275,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2020-12-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -3078,6 +3283,7 @@ def _run_command_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'], @@ -3085,7 +3291,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3101,7 +3311,7 @@ def _run_command_initial( 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 @@ -3110,6 +3320,8 @@ def begin_run_command( 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. @@ -3120,6 +3332,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2020_12_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 @@ -3133,8 +3348,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2020_12_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2020-12-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( 'polling_interval', @@ -3147,6 +3362,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -3170,7 +3386,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_compute_management_client.py index dfbfc3a706df..a34d3b4a48e1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations @@ -111,8 +112,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-03-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. """ @@ -164,7 +168,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_configuration.py index 38944176fa3d..071bdbcdb482 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-03-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_metadata.json index 72305f3f1c28..f8bb89c14abc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_compute_management_client.py index 862abd037644..55e84cc12759 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar cloud_service_role_instances: CloudServiceRoleInstancesOperations operations @@ -113,8 +114,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-03-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_configuration.py index 1cc3d14b99e3..1a3c0cbf0182 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_configuration.py @@ -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-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-03-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_availability_sets_operations.py index 7d7d171fba9a..0be8a1f301b9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_operating_systems_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_operating_systems_operations.py index eb87cba90c2b..05b6857162fb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_operating_systems_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_operating_systems_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -71,17 +70,24 @@ async def get_os_version( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_os_version_request( location=location, os_version_name=os_version_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_os_version.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -95,7 +101,7 @@ async def get_os_version( return deserialized - get_os_version.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}'} # type: ignore + get_os_version.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}"} # type: ignore @distributed_trace @@ -116,6 +122,8 @@ def list_os_versions( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.OSVersionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OSVersionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -127,6 +135,7 @@ def prepare_request(next_link=None): request = build_list_os_versions_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_os_versions.metadata['url'], ) request = _convert_request(request) @@ -137,6 +146,7 @@ def prepare_request(next_link=None): request = build_list_os_versions_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -154,7 +164,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]: @@ -167,7 +181,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_os_versions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions'} # type: ignore + list_os_versions.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions"} # type: ignore @distributed_trace_async async def get_os_family( @@ -194,17 +208,24 @@ async def get_os_family( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_os_family_request( location=location, os_family_name=os_family_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_os_family.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -218,7 +239,7 @@ async def get_os_family( return deserialized - get_os_family.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}'} # type: ignore + get_os_family.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}"} # type: ignore @distributed_trace @@ -239,6 +260,8 @@ def list_os_families( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.OSFamilyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OSFamilyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -250,6 +273,7 @@ def prepare_request(next_link=None): request = build_list_os_families_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_os_families.metadata['url'], ) request = _convert_request(request) @@ -260,6 +284,7 @@ def prepare_request(next_link=None): request = build_list_os_families_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -277,7 +302,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]: @@ -290,4 +319,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_os_families.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies'} # type: ignore + list_os_families.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_role_instances_operations.py index 1f939457609d..30015f68aa70 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_role_instances_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_role_instances_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -48,7 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -61,18 +60,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -82,11 +88,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -113,7 +119,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -125,6 +132,7 @@ async def begin_delete( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -145,10 +153,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace_async async def get( @@ -168,7 +175,7 @@ async def get( :param cloud_service_name: :type cloud_service_name: str :param expand: The expand expression to apply to the operation. 'UserData' is not supported for - cloud services. + cloud services. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: RoleInstance, or the result of cls(response) @@ -181,19 +188,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -207,7 +221,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace_async @@ -237,18 +251,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_instance_view_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_instance_view.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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,7 +283,7 @@ async def get_instance_view( return deserialized - get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView'} # type: ignore + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView"} # type: ignore @distributed_trace @@ -282,7 +303,7 @@ def list( :param cloud_service_name: :type cloud_service_name: str :param expand: The expand expression to apply to the operation. 'UserData' is not supported for - cloud services. + cloud services. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleInstanceListResult or the result of @@ -291,6 +312,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.RoleInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -303,6 +326,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=self.list.metadata['url'], ) @@ -315,6 +339,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -333,7 +358,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]: @@ -346,9 +375,9 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -361,18 +390,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_restart_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -382,11 +418,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart"} # type: ignore @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -414,7 +450,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -426,6 +463,7 @@ async def begin_restart( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -446,12 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart"} # type: ignore - async def _reimage_initial( + async def _reimage_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -464,18 +501,25 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_reimage_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -485,11 +529,11 @@ async def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage"} # type: ignore @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -517,7 +561,8 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -529,6 +574,7 @@ async def begin_reimage( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -549,12 +595,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage"} # type: ignore - async def _rebuild_initial( + async def _rebuild_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -567,18 +612,25 @@ async def _rebuild_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_rebuild_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._rebuild_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -588,11 +640,11 @@ async def _rebuild_initial( if cls: return cls(pipeline_response, None, {}) - _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + _rebuild_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild"} # type: ignore @distributed_trace_async - async def begin_rebuild( + async def begin_rebuild( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -621,7 +673,8 @@ async def begin_rebuild( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -633,6 +686,7 @@ async def begin_rebuild( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -653,10 +707,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + begin_rebuild.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild"} # type: ignore @distributed_trace_async async def get_remote_desktop_file( @@ -685,18 +738,25 @@ async def get_remote_desktop_file( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_remote_desktop_file_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_remote_desktop_file.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -710,5 +770,5 @@ async def get_remote_desktop_file( return deserialized - get_remote_desktop_file.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile'} # type: ignore + get_remote_desktop_file.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_roles_operations.py index 718bd790c196..ea71958333e8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_roles_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_roles_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,18 +72,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( role_name=role_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + 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(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 +104,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}"} # type: ignore @distributed_trace @@ -122,6 +128,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRoleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -134,6 +142,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -145,6 +154,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -162,7 +172,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]: @@ -175,4 +189,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_operations.py index 0b53e785e562..9fa8ccecb186 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CloudServicesOperations: +class CloudServicesOperations: # pylint: disable=too-many-public-methods """CloudServicesOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -72,6 +72,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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'], @@ -79,7 +80,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -97,7 +102,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace_async @@ -115,7 +120,7 @@ async def begin_create_or_update( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: The cloud service object. + :param parameters: The cloud service object. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.CloudService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -130,8 +135,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.CloudService] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -167,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -196,6 +203,7 @@ async def _update_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -203,7 +211,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -217,7 +229,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace_async @@ -234,7 +246,7 @@ async def begin_update( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: The cloud service object. + :param parameters: The cloud service object. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -249,8 +261,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.CloudService] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -262,6 +275,7 @@ async def begin_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -286,12 +300,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -303,17 +316,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -323,11 +343,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -351,7 +371,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -362,6 +383,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -382,10 +404,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace_async async def get( @@ -411,17 +432,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -435,7 +463,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace_async @@ -462,17 +490,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_instance_view_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_instance_view.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -486,7 +521,7 @@ async def get_instance_view( return deserialized - get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView'} # type: ignore + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView"} # type: ignore @distributed_trace @@ -505,6 +540,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -515,6 +552,7 @@ def prepare_request(next_link=None): 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) @@ -524,6 +562,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -541,7 +580,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]: @@ -554,7 +597,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices'} # type: ignore + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices"} # type: ignore @distributed_trace def list( @@ -575,6 +618,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -586,6 +631,7 @@ def prepare_request(next_link=None): 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) @@ -596,6 +642,7 @@ def prepare_request(next_link=None): 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) @@ -613,7 +660,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]: @@ -626,9 +677,9 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices"} # type: ignore - async def _start_initial( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -640,17 +691,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -660,11 +718,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -688,7 +746,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -699,6 +758,7 @@ async def begin_start( raw_result = await self._start_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -719,12 +779,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start"} # type: ignore - async def _power_off_initial( + async def _power_off_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -736,17 +795,24 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_power_off_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -756,11 +822,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/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff"} # type: ignore @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -785,7 +851,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -796,6 +863,7 @@ async def begin_power_off( raw_result = await self._power_off_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -816,12 +884,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -834,6 +901,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -845,6 +913,7 @@ async def _restart_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._restart_initial.metadata['url'], @@ -852,7 +921,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -862,11 +935,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart"} # type: ignore @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -879,7 +952,7 @@ async def begin_restart( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -893,8 +966,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -906,6 +980,7 @@ async def begin_restart( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -927,12 +1002,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart"} # type: ignore - async def _reimage_initial( + async def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -945,6 +1019,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -956,6 +1031,7 @@ async def _reimage_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._reimage_initial.metadata['url'], @@ -963,7 +1039,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -973,11 +1053,11 @@ async def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage"} # type: ignore @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -991,7 +1071,7 @@ async def begin_reimage( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1005,8 +1085,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1018,6 +1099,7 @@ async def begin_reimage( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1039,12 +1121,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage"} # type: ignore - async def _rebuild_initial( + async def _rebuild_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1057,6 +1138,7 @@ async def _rebuild_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1068,6 +1150,7 @@ async def _rebuild_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._rebuild_initial.metadata['url'], @@ -1075,7 +1158,11 @@ async def _rebuild_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1085,11 +1172,11 @@ async def _rebuild_initial( if cls: return cls(pipeline_response, None, {}) - _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + _rebuild_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild"} # type: ignore @distributed_trace_async - async def begin_rebuild( + async def begin_rebuild( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1104,7 +1191,7 @@ async def begin_rebuild( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1118,8 +1205,9 @@ async def begin_rebuild( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1131,6 +1219,7 @@ async def begin_rebuild( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1152,12 +1241,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + begin_rebuild.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild"} # type: ignore - async def _delete_instances_initial( + async def _delete_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1170,6 +1258,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1181,6 +1270,7 @@ async def _delete_instances_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._delete_instances_initial.metadata['url'], @@ -1188,7 +1278,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1198,11 +1292,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/cloudServices/{cloudServiceName}/delete'} # type: ignore + _delete_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete"} # type: ignore @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1215,7 +1309,7 @@ async def begin_delete_instances( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1229,8 +1323,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1242,6 +1337,7 @@ async def begin_delete_instances( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1263,7 +1359,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_update_domain_operations.py index 91864e8a75be..afb1c23fc97c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_update_domain_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_services_update_domain_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -48,7 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _walk_update_domain_initial( + async def _walk_update_domain_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -62,6 +61,7 @@ async def _walk_update_domain_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -74,6 +74,7 @@ async def _walk_update_domain_initial( cloud_service_name=cloud_service_name, update_domain=update_domain, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._walk_update_domain_initial.metadata['url'], @@ -81,7 +82,11 @@ async def _walk_update_domain_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +96,11 @@ async def _walk_update_domain_initial( if cls: return cls(pipeline_response, None, {}) - _walk_update_domain_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + _walk_update_domain_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace_async - async def begin_walk_update_domain( + async def begin_walk_update_domain( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -113,7 +118,7 @@ async def begin_walk_update_domain( domains are identified with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. :type update_domain: int - :param parameters: The update domain object. + :param parameters: The update domain object. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.UpdateDomain :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -127,8 +132,9 @@ async def begin_walk_update_domain( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_walk_update_domain( cloud_service_name=cloud_service_name, update_domain=update_domain, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -162,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_walk_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + begin_walk_update_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace_async async def get_update_domain( @@ -198,18 +204,25 @@ async def get_update_domain( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_update_domain_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, update_domain=update_domain, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_update_domain.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -223,7 +236,7 @@ async def get_update_domain( return deserialized - get_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + get_update_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace @@ -246,6 +259,8 @@ def list_update_domains( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.UpdateDomainListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomainListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -258,6 +273,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_update_domains.metadata['url'], ) request = _convert_request(request) @@ -269,6 +285,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -286,7 +303,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]: @@ -299,4 +320,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_update_domains.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains'} # type: ignore + list_update_domains.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_host_groups_operations.py index 0dc6b9422d99..69b31cfad687 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -138,6 +143,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -146,6 +152,7 @@ async def update( 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'], @@ -153,7 +160,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -167,11 +178,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -194,17 +205,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -214,7 +232,7 @@ 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 @@ -233,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_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -246,18 +264,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -271,7 +296,7 @@ async def get( 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 @@ -292,6 +317,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -303,6 +330,7 @@ def prepare_request(next_link=None): 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) @@ -313,6 +341,7 @@ def prepare_request(next_link=None): 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) @@ -330,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]: @@ -343,7 +376,7 @@ async def get_next(next_link=None): 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( @@ -360,6 +393,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -370,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -379,6 +415,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -396,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]: @@ -409,4 +450,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_hosts_operations.py index 2ec4b8393802..ee84e6c41f4e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -255,8 +267,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,6 +282,7 @@ 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 @@ -293,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -311,18 +324,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -332,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -363,7 +383,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -375,6 +396,7 @@ 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 ) @@ -395,10 +417,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -482,6 +510,8 @@ def list_by_host_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -494,6 +524,7 @@ def prepare_request(next_link=None): 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) @@ -505,6 +536,7 @@ def prepare_request(next_link=None): 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) @@ -522,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]: @@ -535,4 +571,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_images_operations.py index d25b1e793ec5..747d5c3c6178 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_log_analytics_operations.py index 8cc110a95cb9..28e02943ffc8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py index 4ac4a8edf800..0decfff1635a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_proximity_placement_groups_operations.py index c2912e1dafa2..32df9b20d4e2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -230,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) @@ -243,18 +261,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -268,7 +293,7 @@ async def get( 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 @@ -285,6 +310,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -295,6 +322,7 @@ def prepare_request(next_link=None): 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) @@ -304,6 +332,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -321,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]: @@ -334,7 +367,7 @@ async def get_next(next_link=None): 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( @@ -353,6 +386,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +399,7 @@ def prepare_request(next_link=None): 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) @@ -374,6 +410,7 @@ def prepare_request(next_link=None): 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) @@ -391,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]: @@ -404,4 +445,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_point_collections_operations.py index 116be0e7b481..9ea017ad93fc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_point_collections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -78,6 +77,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollection') @@ -86,6 +86,7 @@ async def create_or_update( 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'], @@ -93,7 +94,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -112,7 +117,7 @@ async def create_or_update( 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 @@ -142,6 +147,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') @@ -150,6 +156,7 @@ async def update( 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'], @@ -157,7 +164,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,10 +183,10 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -187,17 +198,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -207,11 +225,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -236,7 +254,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -247,6 +266,7 @@ 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 ) @@ -267,10 +287,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore @distributed_trace_async async def get( @@ -287,7 +306,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_03_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) @@ -300,18 +319,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -326,7 +352,7 @@ async def get( 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 @@ -346,6 +372,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -357,6 +385,7 @@ def prepare_request(next_link=None): 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) @@ -367,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -384,7 +414,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]: @@ -398,7 +432,7 @@ async def get_next(next_link=None): 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( @@ -416,6 +450,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -426,6 +462,7 @@ def prepare_request(next_link=None): 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) @@ -435,6 +472,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -452,7 +490,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]: @@ -466,4 +508,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_points_operations.py index d409599715df..b52a1fc27dcf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_restore_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePoint') @@ -69,6 +69,7 @@ async def _create_initial( 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'], @@ -76,7 +77,11 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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 [201]: @@ -90,7 +95,7 @@ async def _create_initial( 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 @@ -126,8 +131,9 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.RestorePoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,12 +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) + 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 + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -182,18 +188,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -203,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -234,7 +247,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -246,6 +260,7 @@ 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 ) @@ -266,10 +281,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore @distributed_trace_async async def get( @@ -298,18 +312,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -324,5 +345,5 @@ async def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_ssh_public_keys_operations.py index a02de3948d9a..1c61740c9fa5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -71,6 +72,7 @@ def prepare_request(next_link=None): 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) @@ -80,6 +82,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -97,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]: @@ -110,7 +117,7 @@ async def get_next(next_link=None): 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( @@ -130,6 +137,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -141,6 +150,7 @@ def prepare_request(next_link=None): 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) @@ -151,6 +161,7 @@ def prepare_request(next_link=None): 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) @@ -168,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]: @@ -181,7 +196,7 @@ async def get_next(next_link=None): 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( @@ -210,6 +225,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -218,6 +234,7 @@ async def create( 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'], @@ -225,7 +242,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -243,7 +264,7 @@ async def create( 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 @@ -273,6 +294,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -281,6 +303,7 @@ async def update( 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'], @@ -288,7 +311,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +329,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -329,17 +356,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -349,7 +383,7 @@ 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 @@ -376,17 +410,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -400,7 +441,7 @@ async def get( 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 @@ -429,17 +470,24 @@ async def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -453,5 +501,5 @@ async def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_usage_operations.py index 21968a22d118..5f6f48451b86 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extension_images_operations.py index c47dfe099fef..39736df6dfdf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extensions_operations.py index b5c1f2961b43..e3fa1c8bad99 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py index c3b2163bb9bc..6f0ee1f73379 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -80,6 +79,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( location=location, @@ -89,12 +90,17 @@ async def get( 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(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]: @@ -109,7 +115,7 @@ async def get( 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 @@ -138,12 +144,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,6 +163,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_list_request( location=location, @@ -164,6 +173,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -172,7 +182,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -187,7 +201,7 @@ async def list( 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 @@ -218,18 +232,25 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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]: @@ -244,7 +265,7 @@ async def list_offers( 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 @@ -271,17 +292,24 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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]: @@ -296,7 +324,7 @@ async def list_publishers( 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 @@ -330,6 +358,8 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_list_skus_request( location=location, @@ -337,12 +367,17 @@ async def list_skus( 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(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]: @@ -357,5 +392,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_operations.py index a9e99dbab7c3..8c7dd21a3b3b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_run_commands_operations.py index 0a818a957f25..abdb68437c8c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -65,6 +64,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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( @@ -142,17 +149,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -166,7 +180,7 @@ async def get( 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( @@ -175,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"] @@ -183,7 +199,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -192,6 +208,7 @@ async def _create_or_update_initial( 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'], @@ -199,7 +216,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -217,7 +238,7 @@ async def _create_or_update_initial( 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 @@ -227,6 +248,8 @@ async def begin_create_or_update( 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. @@ -240,6 +263,9 @@ 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_03_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 @@ -254,8 +280,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -269,6 +295,7 @@ async def begin_create_or_update( 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 ) @@ -292,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore async def _update_initial( self, @@ -303,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"] @@ -311,7 +339,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -320,6 +348,7 @@ async def _update_initial( 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'], @@ -327,7 +356,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,7 +374,7 @@ async def _update_initial( 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 @@ -351,6 +384,8 @@ async def begin_update( 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. @@ -363,6 +398,9 @@ 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_03_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 @@ -377,8 +415,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -392,6 +430,7 @@ async def begin_update( 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 ) @@ -415,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -433,18 +471,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -454,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -485,7 +530,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -497,6 +543,7 @@ 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 ) @@ -517,10 +564,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) + 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 + 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( @@ -539,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) @@ -552,19 +598,26 @@ async def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -579,7 +632,7 @@ async def get_by_virtual_machine( 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 @@ -596,7 +649,7 @@ 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 @@ -605,6 +658,8 @@ def list_by_virtual_machine( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -617,6 +672,7 @@ def prepare_request(next_link=None): 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'], ) @@ -629,6 +685,7 @@ def prepare_request(next_link=None): 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, ) @@ -647,7 +704,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]: @@ -661,4 +722,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 7ed5b1abbc94..24042867f37f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore async def _update_initial( self, @@ -192,6 +198,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -201,6 +208,7 @@ async def _update_initial( 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'], @@ -208,7 +216,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -264,8 +276,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,6 +291,7 @@ 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 @@ -302,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -320,18 +333,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -341,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -372,7 +392,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -384,6 +405,7 @@ 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 ) @@ -404,10 +426,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -426,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) @@ -439,19 +460,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -465,7 +493,7 @@ async def get( 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 @@ -488,6 +516,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -500,6 +530,7 @@ def prepare_request(next_link=None): 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) @@ -511,6 +542,7 @@ def prepare_request(next_link=None): 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) @@ -528,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]: @@ -541,4 +577,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index a4c70309453a..c2a10e072c88 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,12 +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) + 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 + 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, @@ -252,17 +267,24 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -272,11 +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 @distributed_trace_async - async def begin_start_extension_upgrade( + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -302,7 +324,8 @@ async def begin_start_extension_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,6 +336,7 @@ 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 ) @@ -333,10 +357,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) + 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 + 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( @@ -362,17 +385,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -386,5 +416,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index a0983694e400..acdcabd46e83 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -152,6 +158,7 @@ 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 @@ -176,10 +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) + 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 + 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, @@ -196,6 +202,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') @@ -206,6 +213,7 @@ async def _update_initial( 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'], @@ -213,7 +221,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +239,7 @@ async def _update_initial( 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 @@ -268,8 +280,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,6 +296,7 @@ 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 @@ -307,12 +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) + 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 + 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, @@ -326,6 +339,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -333,12 +348,17 @@ async def _delete_initial( 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) - 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]: @@ -348,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -382,7 +402,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,6 +416,7 @@ 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 ) @@ -415,10 +437,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) + 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 + 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( @@ -440,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) @@ -453,6 +474,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -460,13 +483,18 @@ async def get( 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) - 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]: @@ -481,7 +509,7 @@ async def get( 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 @@ -501,7 +529,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) @@ -514,19 +542,26 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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,5 +576,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index d52090fb9240..daebd14fe124 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -55,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"] @@ -63,7 +64,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -73,6 +74,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +82,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -98,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -109,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. @@ -123,6 +131,9 @@ 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_03_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 @@ -137,8 +148,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -153,6 +164,7 @@ async def begin_create_or_update( 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 ) @@ -176,10 +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) + 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 + 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, @@ -188,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"] @@ -196,7 +209,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -206,6 +219,7 @@ async def _update_initial( 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'], @@ -213,7 +227,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +245,7 @@ async def _update_initial( 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 @@ -238,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. @@ -252,6 +272,9 @@ 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_03_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 @@ -266,8 +289,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -282,6 +305,7 @@ async def begin_update( 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 ) @@ -305,12 +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) + 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 + 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, @@ -324,6 +347,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -331,12 +356,17 @@ async def _delete_initial( 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) - 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]: @@ -346,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -380,7 +410,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,6 +424,7 @@ 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 ) @@ -413,10 +445,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) + 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 + 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( @@ -438,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) @@ -451,6 +482,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -458,13 +491,18 @@ async def get( 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) - 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]: @@ -479,7 +517,7 @@ async def get( 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 @@ -499,7 +537,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -508,6 +546,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -521,6 +561,7 @@ def prepare_request(next_link=None): 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'], ) @@ -534,6 +575,7 @@ def prepare_request(next_link=None): 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, ) @@ -552,7 +594,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]: @@ -566,4 +612,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 4348d0ccffcb..55709e3c7d05 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -62,6 +61,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -74,6 +74,7 @@ async def _reimage_initial( 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'], @@ -81,7 +82,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -112,6 +117,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -126,8 +132,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +147,7 @@ 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 @@ -161,12 +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) + 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 + 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, @@ -179,18 +186,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -200,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -232,7 +246,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -244,6 +259,7 @@ 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 ) @@ -264,12 +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) + 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 + 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, @@ -282,18 +297,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -303,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,7 +358,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -348,6 +371,7 @@ 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 ) @@ -368,10 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -387,6 +410,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -396,6 +420,7 @@ async def _update_initial( 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'], @@ -403,7 +428,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -421,7 +450,7 @@ async def _update_initial( 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 @@ -458,8 +487,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +502,7 @@ 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 @@ -496,12 +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) + 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 + 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, @@ -515,19 +545,26 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -537,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -558,7 +595,7 @@ 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. @@ -572,7 +609,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -585,6 +623,7 @@ 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 ) @@ -605,10 +644,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -629,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_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -642,19 +680,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -668,7 +713,7 @@ async def get( 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 @@ -698,18 +743,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -723,7 +775,7 @@ async def get_instance_view( 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 @@ -744,12 +796,13 @@ 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 @@ -758,6 +811,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -770,6 +825,7 @@ def prepare_request(next_link=None): 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, @@ -784,6 +840,7 @@ def prepare_request(next_link=None): 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, @@ -804,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]: @@ -817,9 +878,9 @@ async def get_next(next_link=None): 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, @@ -833,19 +894,26 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -855,11 +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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -879,7 +947,7 @@ 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. @@ -893,7 +961,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -906,6 +975,7 @@ 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 ) @@ -926,12 +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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -944,18 +1013,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -965,11 +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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -996,7 +1072,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1008,6 +1085,7 @@ 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 ) @@ -1028,12 +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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1046,18 +1123,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1067,11 +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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1098,7 +1182,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1110,6 +1195,7 @@ 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 ) @@ -1130,12 +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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1148,18 +1233,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1169,11 +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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1201,7 +1293,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1213,6 +1306,7 @@ 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 ) @@ -1233,10 +1327,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) + 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 + 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( @@ -1258,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) @@ -1271,19 +1364,26 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -1298,10 +1398,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + 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( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1314,18 +1414,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1335,11 +1442,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1366,7 +1473,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1378,6 +1486,7 @@ 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 ) @@ -1398,13 +1507,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1430,18 +1538,25 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -1451,7 +1566,7 @@ 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( @@ -1460,6 +1575,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"]] @@ -1468,7 +1585,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1477,6 +1594,7 @@ async def _run_command_initial( 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'], @@ -1484,7 +1602,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1500,7 +1622,7 @@ async def _run_command_initial( 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 @@ -1510,6 +1632,8 @@ async def begin_run_command( 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. @@ -1522,6 +1646,9 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_03_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 @@ -1536,8 +1663,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -1551,6 +1678,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1574,7 +1702,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_sets_operations.py index 42bb8e7ff6f3..5dd2e42fdd82 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -117,7 +124,7 @@ async def get_next(next_link=None): 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, @@ -132,6 +139,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -140,6 +148,7 @@ async def _create_or_update_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'], @@ -147,7 +156,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -165,7 +178,7 @@ async def _create_or_update_initial( 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 @@ -198,8 +211,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -211,6 +225,7 @@ 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 @@ -235,10 +250,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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -253,6 +267,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -261,6 +276,7 @@ async def _update_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'], @@ -268,7 +284,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,7 +302,7 @@ async def _update_initial( 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 @@ -315,8 +335,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -328,6 +349,7 @@ 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 @@ -352,12 +374,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) + 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 + 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, @@ -370,18 +391,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -391,11 +419,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -409,6 +437,7 @@ 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. @@ -422,7 +451,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -434,6 +464,7 @@ 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 ) @@ -454,10 +485,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -475,7 +505,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_03_01.models.ExpandTypesForGetVMScaleSets :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSet, or the result of cls(response) @@ -488,18 +518,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -513,10 +550,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -529,6 +566,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -540,6 +578,7 @@ async def _deallocate_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'], @@ -547,7 +586,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -557,11 +600,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -576,7 +619,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -591,8 +635,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -604,6 +649,7 @@ 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 @@ -625,12 +671,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) + 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 + 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, @@ -644,6 +689,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -652,6 +698,7 @@ async def _delete_instances_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, @@ -660,7 +707,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -670,11 +721,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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -692,7 +743,7 @@ async def begin_delete_instances( :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs :param force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). + 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. @@ -706,8 +757,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -720,6 +772,7 @@ 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 @@ -741,10 +794,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) + 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 + 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( @@ -770,17 +822,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -794,7 +853,7 @@ async def get_instance_view( 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 @@ -814,6 +873,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -825,6 +886,7 @@ def prepare_request(next_link=None): 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) @@ -835,6 +897,7 @@ def prepare_request(next_link=None): 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) @@ -852,7 +915,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]: @@ -865,7 +932,7 @@ async def get_next(next_link=None): 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( @@ -883,6 +950,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -893,6 +962,7 @@ def prepare_request(next_link=None): 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) @@ -902,6 +972,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -919,7 +990,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]: @@ -932,7 +1007,7 @@ async def get_next(next_link=None): 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( @@ -955,6 +1030,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -967,6 +1044,7 @@ def prepare_request(next_link=None): 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) @@ -978,6 +1056,7 @@ def prepare_request(next_link=None): 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) @@ -995,7 +1074,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]: @@ -1008,7 +1091,7 @@ async def get_next(next_link=None): 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( @@ -1030,6 +1113,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1042,6 +1127,7 @@ def prepare_request(next_link=None): 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) @@ -1053,6 +1139,7 @@ def prepare_request(next_link=None): 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) @@ -1070,7 +1157,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]: @@ -1083,9 +1174,9 @@ async def get_next(next_link=None): 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, @@ -1099,6 +1190,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1110,6 +1202,7 @@ async def _power_off_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, @@ -1118,7 +1211,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1128,11 +1225,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1150,9 +1247,10 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1167,8 +1265,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1181,6 +1280,7 @@ 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 @@ -1202,12 +1302,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) + 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 + 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, @@ -1220,6 +1319,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1231,6 +1331,7 @@ async def _restart_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'], @@ -1238,7 +1339,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1248,11 +1353,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1265,7 +1370,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1280,8 +1386,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1293,6 +1400,7 @@ 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 @@ -1314,12 +1422,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) + 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 + 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, @@ -1332,6 +1439,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1343,6 +1451,7 @@ async def _start_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'], @@ -1350,7 +1459,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1360,11 +1473,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1377,7 +1490,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1392,8 +1506,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1405,6 +1520,7 @@ 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 @@ -1426,12 +1542,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) + 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 + 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, @@ -1444,6 +1559,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1455,6 +1571,7 @@ async def _redeploy_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'], @@ -1462,7 +1579,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1472,11 +1593,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1490,7 +1611,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1505,8 +1627,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1518,6 +1641,7 @@ 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 @@ -1539,12 +1663,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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1557,6 +1680,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1568,6 +1692,7 @@ async def _perform_maintenance_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'], @@ -1575,7 +1700,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1585,11 +1714,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1605,7 +1734,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1620,8 +1750,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1633,6 +1764,7 @@ 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 @@ -1654,12 +1786,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1672,6 +1803,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1680,6 +1812,7 @@ async def _update_instances_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'], @@ -1687,7 +1820,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1697,11 +1834,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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1729,8 +1866,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1742,6 +1880,7 @@ 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 @@ -1763,12 +1902,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) + 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 + 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, @@ -1781,6 +1919,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -1792,6 +1931,7 @@ async def _reimage_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'], @@ -1799,7 +1939,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1809,11 +1953,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1828,7 +1972,7 @@ 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. + :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_03_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -1843,8 +1987,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1856,6 +2001,7 @@ 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 @@ -1877,12 +2023,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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1895,6 +2040,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1906,6 +2052,7 @@ async def _reimage_all_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'], @@ -1913,7 +2060,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1923,11 +2074,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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1941,7 +2092,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1956,8 +2108,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1969,6 +2122,7 @@ 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 @@ -1990,10 +2144,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) + 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 + 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( @@ -2024,18 +2177,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -2049,11 +2209,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + async def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2080,6 +2240,7 @@ async def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2088,6 +2249,7 @@ async def convert_to_single_placement_group( 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'], @@ -2095,7 +2257,11 @@ async def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2105,10 +2271,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, @@ -2121,6 +2287,7 @@ async def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -2129,6 +2296,7 @@ async def _set_orchestration_service_state_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'], @@ -2136,7 +2304,11 @@ async def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2146,11 +2318,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 @distributed_trace_async - async def begin_set_orchestration_service_state( + async def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2177,8 +2349,9 @@ async def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2190,6 +2363,7 @@ 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 @@ -2211,7 +2385,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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_sizes_operations.py index 78383e79a38f..325b408a0cf0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -64,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -85,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -102,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]: @@ -115,4 +121,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machines_operations.py index f28b657f0563..9608eb21e785 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -318,8 +338,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,6 +352,7 @@ 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 @@ -355,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -373,6 +394,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -381,6 +403,7 @@ async def _update_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'], @@ -388,7 +411,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -402,7 +429,7 @@ async def _update_initial( 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 @@ -435,8 +462,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -448,6 +476,7 @@ 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 @@ -472,12 +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) + 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 + 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, @@ -490,18 +518,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -511,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -528,7 +563,8 @@ 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. @@ -542,7 +578,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -554,6 +591,7 @@ 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 ) @@ -574,10 +612,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -597,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_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -609,18 +647,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -634,7 +679,7 @@ async def get( 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 @@ -661,17 +706,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -685,10 +737,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -700,17 +752,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -720,11 +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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -749,7 +808,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -760,6 +820,7 @@ 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 ) @@ -780,12 +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) + 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 + 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, @@ -797,17 +857,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -817,11 +884,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -846,7 +913,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -857,6 +925,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -877,13 +946,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -911,17 +979,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -931,7 +1006,7 @@ 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 @@ -952,6 +1027,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -963,6 +1040,7 @@ def prepare_request(next_link=None): 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) @@ -973,6 +1051,7 @@ def prepare_request(next_link=None): 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) @@ -990,7 +1069,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]: @@ -1003,7 +1086,7 @@ async def get_next(next_link=None): 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( @@ -1015,7 +1098,7 @@ 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 @@ -1024,6 +1107,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1034,6 +1119,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1044,6 +1130,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1062,7 +1149,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,7 +1166,7 @@ async def get_next(next_link=None): 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( @@ -1098,6 +1189,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1110,6 +1203,7 @@ def prepare_request(next_link=None): 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) @@ -1121,6 +1215,7 @@ def prepare_request(next_link=None): 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) @@ -1138,7 +1233,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]: @@ -1151,9 +1250,9 @@ async def get_next(next_link=None): 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, @@ -1166,18 +1265,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -1187,11 +1293,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1207,7 +1313,7 @@ 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. @@ -1221,7 +1327,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1233,6 +1340,7 @@ 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 ) @@ -1253,12 +1361,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _reapply_initial( + async def _reapply_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1270,17 +1377,24 @@ async def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -1290,11 +1404,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 @distributed_trace_async - async def begin_reapply( + async def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1318,7 +1432,8 @@ async def begin_reapply( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1329,6 +1444,7 @@ 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 ) @@ -1349,12 +1465,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) + 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 + begin_reapply.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1366,17 +1481,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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,11 +1508,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1414,7 +1536,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1425,6 +1548,7 @@ 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 ) @@ -1445,12 +1569,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) + 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 + 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, @@ -1462,17 +1585,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -1482,11 +1612,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1510,7 +1640,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1521,6 +1652,7 @@ 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 ) @@ -1541,12 +1673,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) + 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 + 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, @@ -1558,17 +1689,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -1578,11 +1716,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1606,7 +1744,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1617,6 +1756,7 @@ 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 ) @@ -1637,12 +1777,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) + 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 + 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, @@ -1655,6 +1794,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1666,6 +1806,7 @@ async def _reimage_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'], @@ -1673,7 +1814,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1683,11 +1828,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1700,7 +1845,8 @@ 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_03_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1714,8 +1860,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1727,6 +1874,7 @@ 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 @@ -1748,10 +1896,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) + 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 + 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( @@ -1769,7 +1916,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) @@ -1782,18 +1929,25 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -1808,10 +1962,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1823,17 +1977,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -1843,11 +2004,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1871,7 +2032,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1882,6 +2044,7 @@ 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 ) @@ -1902,13 +2065,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1931,17 +2093,24 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -1951,7 +2120,7 @@ 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( @@ -1966,17 +2135,24 @@ async def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -1992,7 +2168,7 @@ async def _assess_patches_initial( 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 @@ -2022,7 +2198,8 @@ async def begin_assess_patches( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -2033,6 +2210,7 @@ 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 ) @@ -2056,10 +2234,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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore async def _install_patches_initial( self, @@ -2074,6 +2251,7 @@ async def _install_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') @@ -2082,6 +2260,7 @@ async def _install_patches_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'], @@ -2089,7 +2268,11 @@ async def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2105,7 +2288,7 @@ async def _install_patches_initial( 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 @@ -2139,8 +2322,9 @@ async def begin_install_patches( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstallPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2152,6 +2336,7 @@ 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 @@ -2176,16 +2361,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) + 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 + 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"]] @@ -2194,7 +2380,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2202,6 +2388,7 @@ async def _run_command_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'], @@ -2209,7 +2396,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2225,7 +2416,7 @@ async def _run_command_initial( 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 @@ -2234,6 +2425,8 @@ async def begin_run_command( 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. @@ -2244,6 +2437,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_03_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 @@ -2258,8 +2454,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -2272,6 +2468,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2295,7 +2492,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_compute_management_client_enums.py index 76e611e2dc12..9d628f8ac2d9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_compute_management_client_enums.py @@ -271,7 +271,6 @@ class OrchestrationServiceNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enu """ AUTOMATIC_REPAIRS = "AutomaticRepairs" - DUMMY_ORCHESTRATION_SERVICE_NAME = "DummyOrchestrationServiceName" class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models_py3.py index 46cfc50fbd59..78c4b70600b4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models_py3.py @@ -4877,7 +4877,7 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceNames :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". @@ -4903,7 +4903,7 @@ def __init__( ): """ :keyword service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :paramtype service_name: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceNames :keyword action: Required. The action to be performed. Possible values include: "Resume", @@ -4921,8 +4921,7 @@ class OrchestrationServiceSummary(msrest.serialization.Model): 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". + :ivar service_name: The name of the service. Possible values include: "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceNames :ivar service_state: The current state of the service. Possible values include: "NotRunning", "Running", "Suspended". diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_availability_sets_operations.py index 42f1081f7583..bd8362b0992b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -185,31 +187,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -253,31 +257,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,6 +335,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -338,6 +344,7 @@ def create_or_update( 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'], @@ -345,7 +352,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -359,7 +370,7 @@ def create_or_update( 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 @@ -389,6 +400,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -397,6 +409,7 @@ def update( 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'], @@ -404,7 +417,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +435,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -445,17 +462,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -465,7 +489,7 @@ 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 @@ -492,17 +516,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -516,7 +547,7 @@ def get( 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 @@ -528,7 +559,7 @@ 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 @@ -537,6 +568,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -547,6 +580,7 @@ def prepare_request(next_link=None): 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'], ) @@ -557,6 +591,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -575,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]: @@ -588,7 +627,7 @@ def get_next(next_link=None): 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( @@ -607,6 +646,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -618,6 +659,7 @@ def prepare_request(next_link=None): 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) @@ -628,6 +670,7 @@ def prepare_request(next_link=None): 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) @@ -645,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]: @@ -658,7 +705,7 @@ def get_next(next_link=None): 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( @@ -681,6 +728,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_operating_systems_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_operating_systems_operations.py index d15a54ced68a..a8fa300a931c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_operating_systems_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_operating_systems_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_get_os_version_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}") # pylint: disable=line-too-long path_format_arguments = { "location": _SERIALIZER.url("location", location, 'str'), "osVersionName": _SERIALIZER.url("os_version_name", os_version_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -66,30 +67,31 @@ def build_list_os_versions_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -100,31 +102,32 @@ def build_get_os_family_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}") # pylint: disable=line-too-long path_format_arguments = { "location": _SERIALIZER.url("location", location, 'str'), "osFamilyName": _SERIALIZER.url("os_family_name", os_family_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -134,30 +137,31 @@ def build_list_os_families_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -208,17 +212,24 @@ def get_os_version( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_os_version_request( location=location, os_version_name=os_version_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_os_version.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -232,7 +243,7 @@ def get_os_version( return deserialized - get_os_version.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}'} # type: ignore + get_os_version.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}"} # type: ignore @distributed_trace @@ -253,6 +264,8 @@ def list_os_versions( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.OSVersionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OSVersionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -264,6 +277,7 @@ def prepare_request(next_link=None): request = build_list_os_versions_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_os_versions.metadata['url'], ) request = _convert_request(request) @@ -274,6 +288,7 @@ def prepare_request(next_link=None): request = build_list_os_versions_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -291,7 +306,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]: @@ -304,7 +323,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_os_versions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions'} # type: ignore + list_os_versions.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions"} # type: ignore @distributed_trace def get_os_family( @@ -331,17 +350,24 @@ def get_os_family( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_os_family_request( location=location, os_family_name=os_family_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_os_family.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -355,7 +381,7 @@ def get_os_family( return deserialized - get_os_family.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}'} # type: ignore + get_os_family.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}"} # type: ignore @distributed_trace @@ -375,6 +401,8 @@ def list_os_families( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.OSFamilyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OSFamilyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -386,6 +414,7 @@ def prepare_request(next_link=None): request = build_list_os_families_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_os_families.metadata['url'], ) request = _convert_request(request) @@ -396,6 +425,7 @@ def prepare_request(next_link=None): request = build_list_os_families_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -413,7 +443,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]: @@ -426,4 +460,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_os_families.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies'} # type: ignore + list_os_families.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_role_instances_operations.py index 61973ee4a8d7..494966388452 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_role_instances_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_role_instances_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, IO, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -46,21 +47,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -74,10 +75,11 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -85,23 +87,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -113,10 +115,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -124,21 +127,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -151,33 +154,34 @@ def build_list_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -189,10 +193,11 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -200,21 +205,21 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -226,10 +231,11 @@ def build_reimage_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -237,21 +243,21 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,10 +269,11 @@ def build_rebuild_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -274,21 +281,21 @@ def build_rebuild_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -300,10 +307,11 @@ def build_get_remote_desktop_file_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/x-rdp" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile") # pylint: disable=line-too-long path_format_arguments = { "roleInstanceName": _SERIALIZER.url("role_instance_name", role_instance_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -311,21 +319,21 @@ def build_get_remote_desktop_file_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -351,7 +359,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -364,18 +372,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -385,11 +400,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -416,7 +431,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -428,6 +444,7 @@ def begin_delete( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -448,10 +465,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace def get( @@ -471,7 +487,7 @@ def get( :param cloud_service_name: :type cloud_service_name: str :param expand: The expand expression to apply to the operation. 'UserData' is not supported for - cloud services. + cloud services. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: RoleInstance, or the result of cls(response) @@ -484,19 +500,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -510,7 +533,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}"} # type: ignore @distributed_trace @@ -540,18 +563,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_instance_view_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_instance_view.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -565,7 +595,7 @@ def get_instance_view( return deserialized - get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView'} # type: ignore + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView"} # type: ignore @distributed_trace @@ -585,7 +615,7 @@ def list( :param cloud_service_name: :type cloud_service_name: str :param expand: The expand expression to apply to the operation. 'UserData' is not supported for - cloud services. + cloud services. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleInstanceListResult or the result of @@ -594,6 +624,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.RoleInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RoleInstanceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -606,6 +638,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=self.list.metadata['url'], ) @@ -618,6 +651,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -636,7 +670,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]: @@ -649,9 +687,9 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -664,18 +702,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_restart_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -685,11 +730,11 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart"} # type: ignore @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -717,7 +762,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -729,6 +775,7 @@ def begin_restart( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -749,12 +796,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -767,18 +813,25 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_reimage_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -788,11 +841,11 @@ def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage"} # type: ignore @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -820,7 +873,8 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -832,6 +886,7 @@ def begin_reimage( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -852,12 +907,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage'} # type: ignore + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage"} # type: ignore - def _rebuild_initial( + def _rebuild_initial( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -870,18 +924,25 @@ def _rebuild_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_rebuild_request_initial( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._rebuild_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -891,11 +952,11 @@ def _rebuild_initial( if cls: return cls(pipeline_response, None, {}) - _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + _rebuild_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild"} # type: ignore @distributed_trace - def begin_rebuild( + def begin_rebuild( # pylint: disable=inconsistent-return-statements self, role_instance_name: str, resource_group_name: str, @@ -924,7 +985,8 @@ def begin_rebuild( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -936,6 +998,7 @@ def begin_rebuild( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -956,10 +1019,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild'} # type: ignore + begin_rebuild.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild"} # type: ignore @distributed_trace def get_remote_desktop_file( @@ -988,18 +1050,25 @@ def get_remote_desktop_file( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_remote_desktop_file_request( role_instance_name=role_instance_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_remote_desktop_file.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1013,5 +1082,5 @@ def get_remote_desktop_file( return deserialized - get_remote_desktop_file.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile'} # type: ignore + get_remote_desktop_file.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_roles_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_roles_operations.py index 8eb45a04334d..c300e8b57623 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_roles_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_roles_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}") # pylint: disable=line-too-long path_format_arguments = { "roleName": _SERIALIZER.url("role_name", role_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -44,21 +45,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -69,31 +70,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -146,18 +148,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( role_name=role_name, resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + 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(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]: @@ -171,7 +180,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}"} # type: ignore @distributed_trace @@ -195,6 +204,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceRoleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -207,6 +218,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -218,6 +230,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -235,7 +248,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]: @@ -248,4 +265,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_operations.py index 35d22e11b2d2..f8d9a9032985 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -193,31 +195,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -226,29 +229,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -258,30 +262,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -292,31 +297,32 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -327,31 +333,32 @@ def build_power_off_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -365,35 +372,35 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -409,35 +416,35 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -453,35 +460,35 @@ def build_rebuild_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -497,41 +504,41 @@ def build_delete_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class CloudServicesOperations(object): +class CloudServicesOperations(object): # pylint: disable=too-many-public-methods """CloudServicesOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -566,6 +573,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -577,6 +585,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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'], @@ -584,7 +593,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -602,7 +615,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace @@ -620,7 +633,7 @@ def begin_create_or_update( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: The cloud service object. + :param parameters: The cloud service object. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.CloudService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -635,8 +648,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.CloudService] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -648,6 +662,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -672,10 +687,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore def _update_initial( self, @@ -690,6 +704,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -701,6 +716,7 @@ def _update_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -708,7 +724,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -722,7 +742,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace @@ -739,7 +759,7 @@ def begin_update( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: The cloud service object. + :param parameters: The cloud service object. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -754,8 +774,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.CloudService] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudService"] lro_delay = kwargs.pop( 'polling_interval', @@ -767,6 +788,7 @@ def begin_update( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -791,12 +813,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -808,17 +829,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -828,11 +856,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -856,7 +884,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -867,6 +896,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -887,10 +917,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace def get( @@ -916,17 +945,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -940,7 +976,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}"} # type: ignore @distributed_trace @@ -967,17 +1003,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_instance_view_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_instance_view.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -991,7 +1034,7 @@ def get_instance_view( return deserialized - get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView'} # type: ignore + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView"} # type: ignore @distributed_trace @@ -1010,6 +1053,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1020,6 +1065,7 @@ def prepare_request(next_link=None): 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) @@ -1029,6 +1075,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1046,7 +1093,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]: @@ -1059,7 +1110,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices'} # type: ignore + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices"} # type: ignore @distributed_trace def list( @@ -1080,6 +1131,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.CloudServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CloudServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1091,6 +1144,7 @@ def prepare_request(next_link=None): 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) @@ -1101,6 +1155,7 @@ def prepare_request(next_link=None): 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) @@ -1118,7 +1173,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]: @@ -1131,9 +1190,9 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1145,17 +1204,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_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) - 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]: @@ -1165,11 +1231,11 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start"} # type: ignore @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1193,7 +1259,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1204,6 +1271,7 @@ def begin_start( raw_result = self._start_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1224,12 +1292,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start"} # type: ignore - def _power_off_initial( + def _power_off_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1241,17 +1308,24 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_power_off_request_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._power_off_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1261,11 +1335,11 @@ def _power_off_initial( if cls: return cls(pipeline_response, None, {}) - _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff"} # type: ignore @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1290,7 +1364,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1301,6 +1376,7 @@ def begin_power_off( raw_result = self._power_off_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1321,12 +1397,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff'} # type: ignore + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1339,6 +1414,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1350,6 +1426,7 @@ def _restart_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._restart_initial.metadata['url'], @@ -1357,7 +1434,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1367,11 +1448,11 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart"} # type: ignore @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1384,7 +1465,7 @@ def begin_restart( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1398,8 +1479,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1411,6 +1493,7 @@ def begin_restart( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1432,12 +1515,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1450,6 +1532,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1461,6 +1544,7 @@ def _reimage_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._reimage_initial.metadata['url'], @@ -1468,7 +1552,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1478,11 +1566,11 @@ def _reimage_initial( if cls: return cls(pipeline_response, None, {}) - _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage"} # type: ignore @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1496,7 +1584,7 @@ def begin_reimage( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1510,8 +1598,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1523,6 +1612,7 @@ def begin_reimage( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1544,12 +1634,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage'} # type: ignore + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage"} # type: ignore - def _rebuild_initial( + def _rebuild_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1562,6 +1651,7 @@ def _rebuild_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1573,6 +1663,7 @@ def _rebuild_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._rebuild_initial.metadata['url'], @@ -1580,7 +1671,11 @@ def _rebuild_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1590,11 +1685,11 @@ def _rebuild_initial( if cls: return cls(pipeline_response, None, {}) - _rebuild_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + _rebuild_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild"} # type: ignore @distributed_trace - def begin_rebuild( + def begin_rebuild( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1609,7 +1704,7 @@ def begin_rebuild( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1623,8 +1718,9 @@ def begin_rebuild( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1636,6 +1732,7 @@ def begin_rebuild( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1657,12 +1754,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_rebuild.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild'} # type: ignore + begin_rebuild.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild"} # type: ignore - def _delete_instances_initial( + def _delete_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1675,6 +1771,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1686,6 +1783,7 @@ def _delete_instances_initial( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._delete_instances_initial.metadata['url'], @@ -1693,7 +1791,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1703,11 +1805,11 @@ def _delete_instances_initial( if cls: return cls(pipeline_response, None, {}) - _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + _delete_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete"} # type: ignore @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -1720,7 +1822,7 @@ def begin_delete_instances( :type resource_group_name: str :param cloud_service_name: Name of the cloud service. :type cloud_service_name: str - :param parameters: List of cloud service role instance names. + :param parameters: List of cloud service role instance names. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RoleInstances :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1734,8 +1836,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1747,6 +1850,7 @@ def begin_delete_instances( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1768,7 +1872,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete'} # type: ignore + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_update_domain_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_update_domain_operations.py index 45744c6623a8..57a57e3b3efd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_update_domain_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_services_update_domain_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_walk_update_domain_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), @@ -52,23 +52,23 @@ def build_walk_update_domain_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,10 +82,11 @@ def build_get_update_domain_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), @@ -93,21 +94,21 @@ def build_get_update_domain_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -118,31 +119,32 @@ def build_list_update_domains_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cloudServiceName": _SERIALIZER.url("cloud_service_name", cloud_service_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -168,7 +170,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _walk_update_domain_initial( + def _walk_update_domain_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -182,6 +184,7 @@ def _walk_update_domain_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -194,6 +197,7 @@ def _walk_update_domain_initial( cloud_service_name=cloud_service_name, update_domain=update_domain, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._walk_update_domain_initial.metadata['url'], @@ -201,7 +205,11 @@ def _walk_update_domain_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -211,11 +219,11 @@ def _walk_update_domain_initial( if cls: return cls(pipeline_response, None, {}) - _walk_update_domain_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + _walk_update_domain_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace - def begin_walk_update_domain( + def begin_walk_update_domain( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cloud_service_name: str, @@ -233,7 +241,7 @@ def begin_walk_update_domain( domains are identified with a zero-based index: the first update domain has an ID of 0, the second has an ID of 1, and so on. :type update_domain: int - :param parameters: The update domain object. + :param parameters: The update domain object. Default value is None. :type parameters: ~azure.mgmt.compute.v2021_03_01.models.UpdateDomain :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -247,8 +255,9 @@ def begin_walk_update_domain( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +270,7 @@ def begin_walk_update_domain( cloud_service_name=cloud_service_name, update_domain=update_domain, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -282,10 +292,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_walk_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + begin_walk_update_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace def get_update_domain( @@ -318,18 +327,25 @@ def get_update_domain( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_update_domain_request( resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, update_domain=update_domain, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get_update_domain.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -343,7 +359,7 @@ def get_update_domain( return deserialized - get_update_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}'} # type: ignore + get_update_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}"} # type: ignore @distributed_trace @@ -366,6 +382,8 @@ def list_update_domains( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.UpdateDomainListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.UpdateDomainListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -378,6 +396,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_update_domains.metadata['url'], ) request = _convert_request(request) @@ -389,6 +408,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cloud_service_name=cloud_service_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -406,7 +426,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]: @@ -419,4 +443,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_update_domains.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains'} # type: ignore + list_update_domains.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_host_groups_operations.py index f62b25932dff..c90e2a5f3d9d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -188,30 +190,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -220,29 +223,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -297,6 +301,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -305,6 +310,7 @@ def create_or_update( 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'], @@ -312,7 +318,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -330,7 +340,7 @@ def create_or_update( 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 @@ -360,6 +370,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -368,6 +379,7 @@ def update( 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'], @@ -375,7 +387,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -389,11 +405,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -416,17 +432,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -436,7 +459,7 @@ 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 @@ -455,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_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHostGroup, or the result of cls(response) @@ -468,18 +491,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -493,7 +523,7 @@ def get( 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 @@ -514,6 +544,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -525,6 +557,7 @@ def prepare_request(next_link=None): 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) @@ -535,6 +568,7 @@ def prepare_request(next_link=None): 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) @@ -552,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]: @@ -565,7 +603,7 @@ def get_next(next_link=None): 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( @@ -582,6 +620,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -592,6 +632,7 @@ def prepare_request(next_link=None): 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) @@ -601,6 +642,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -618,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]: @@ -631,4 +677,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_hosts_operations.py index 6eee160bcfd5..9e406a23ff3e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_by_host_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -332,8 +341,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -346,6 +356,7 @@ 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 @@ -370,10 +381,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore def _update_initial( self, @@ -389,6 +399,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -398,6 +409,7 @@ def _update_initial( 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'], @@ -405,7 +417,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,7 +435,7 @@ def _update_initial( 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 @@ -454,8 +470,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,6 +485,7 @@ 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 @@ -492,12 +510,11 @@ 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) + 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 + 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: str, host_group_name: str, @@ -510,18 +527,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -531,11 +555,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -562,7 +586,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -574,6 +599,7 @@ 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 ) @@ -594,10 +620,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace def get( @@ -618,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_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: DedicatedHost, or the result of cls(response) @@ -631,19 +656,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -657,7 +689,7 @@ def get( 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 @@ -681,6 +713,8 @@ def list_by_host_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +727,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +739,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +774,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_images_operations.py index 0aed16cd0526..4aa5419411ec 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -154,33 +155,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -291,6 +296,7 @@ def _create_or_update_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'], @@ -298,7 +304,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -316,7 +326,7 @@ def _create_or_update_initial( 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 @@ -347,8 +357,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -360,6 +371,7 @@ 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 @@ -384,10 +396,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -402,6 +413,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -410,6 +422,7 @@ def _update_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'], @@ -417,7 +430,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -435,7 +452,7 @@ def _update_initial( 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 @@ -466,8 +483,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +497,7 @@ 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 @@ -503,12 +522,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -520,17 +538,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -540,11 +565,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -568,7 +593,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,6 +605,7 @@ 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 ) @@ -599,10 +626,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -618,7 +644,7 @@ 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) @@ -631,18 +657,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -656,7 +689,7 @@ def get( 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 @@ -674,6 +707,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -685,6 +720,7 @@ def prepare_request(next_link=None): 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) @@ -695,6 +731,7 @@ def prepare_request(next_link=None): 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) @@ -712,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]: @@ -725,7 +766,7 @@ def get_next(next_link=None): 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( @@ -740,6 +781,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -750,6 +793,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -759,6 +803,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -776,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]: @@ -789,4 +838,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_log_analytics_operations.py index f08acb678c9c..cfa474343f16 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py index 0705ca4d7bd3..96a34f89a3b1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_proximity_placement_groups_operations.py index 743df76995e1..b20f861da0bf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( include_colocation_status: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -187,29 +189,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -295,6 +299,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -303,6 +308,7 @@ def create_or_update( 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'], @@ -310,7 +316,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -328,7 +338,7 @@ def create_or_update( 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 @@ -358,6 +368,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -366,6 +377,7 @@ def update( 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'], @@ -373,7 +385,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -387,11 +403,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -414,17 +430,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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,7 +457,7 @@ 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 @@ -452,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) @@ -465,18 +488,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -490,7 +520,7 @@ def get( 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 @@ -507,6 +537,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -517,6 +549,7 @@ def prepare_request(next_link=None): 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) @@ -526,6 +559,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -543,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]: @@ -556,7 +594,7 @@ def get_next(next_link=None): 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( @@ -575,6 +613,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -586,6 +626,7 @@ def prepare_request(next_link=None): 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) @@ -596,6 +637,7 @@ def prepare_request(next_link=None): 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) @@ -613,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]: @@ -626,4 +672,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_point_collections_operations.py index c6d8a8cf7f69..2ca0f2d2e7f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_point_collections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( restore_point_collection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -160,33 +161,34 @@ def build_get_request( expand: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,30 +198,31 @@ def build_list_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -228,29 +231,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -306,6 +310,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollection') @@ -314,6 +319,7 @@ def create_or_update( 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'], @@ -321,7 +327,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -340,7 +350,7 @@ def create_or_update( 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 @@ -370,6 +380,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') @@ -378,6 +389,7 @@ def update( 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'], @@ -385,7 +397,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -400,10 +416,10 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -415,17 +431,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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,11 +458,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -464,7 +487,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -475,6 +499,7 @@ 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 ) @@ -495,10 +520,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore @distributed_trace def get( @@ -515,7 +539,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_03_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) @@ -528,18 +552,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -554,7 +585,7 @@ def get( 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 @@ -574,6 +605,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -585,6 +618,7 @@ def prepare_request(next_link=None): 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) @@ -595,6 +629,7 @@ def prepare_request(next_link=None): 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) @@ -612,7 +647,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]: @@ -626,7 +665,7 @@ def get_next(next_link=None): 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( @@ -644,6 +683,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -654,6 +695,7 @@ def prepare_request(next_link=None): 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) @@ -663,6 +705,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -680,7 +723,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]: @@ -694,4 +741,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_points_operations.py index 2ce65a87d6d4..d7bad2d9ce1a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_restore_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + _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'), @@ -51,23 +51,23 @@ def build_create_request_initial( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -81,10 +81,11 @@ def build_delete_request_initial( restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + _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'), @@ -92,21 +93,21 @@ def build_delete_request_initial( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -118,10 +119,11 @@ def build_get_request( restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + _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'), @@ -129,21 +131,21 @@ def build_get_request( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,6 +185,7 @@ def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePoint') @@ -192,6 +195,7 @@ def _create_initial( 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'], @@ -199,7 +203,11 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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 [201]: @@ -213,7 +221,7 @@ def _create_initial( 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 @@ -249,8 +257,9 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.RestorePoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +272,7 @@ 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 @@ -287,12 +297,11 @@ 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) + 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 + 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: str, restore_point_collection_name: str, @@ -305,18 +314,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -326,11 +342,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -357,7 +373,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,6 +386,7 @@ 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 ) @@ -389,10 +407,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore @distributed_trace def get( @@ -421,18 +438,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -447,5 +471,5 @@ def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_ssh_public_keys_operations.py index a5d45ac1f295..ff4988ce48f5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,30 +64,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -100,35 +102,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -144,35 +146,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -185,25 +187,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -214,31 +217,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -249,31 +253,32 @@ def build_generate_key_pair_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -314,6 +319,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -324,6 +331,7 @@ def prepare_request(next_link=None): 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) @@ -333,6 +341,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -350,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]: @@ -363,7 +376,7 @@ def get_next(next_link=None): 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( @@ -383,6 +396,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -394,6 +409,7 @@ def prepare_request(next_link=None): 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) @@ -404,6 +420,7 @@ def prepare_request(next_link=None): 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) @@ -421,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]: @@ -434,7 +455,7 @@ def get_next(next_link=None): 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( @@ -463,6 +484,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -471,6 +493,7 @@ def create( 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'], @@ -478,7 +501,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def create( 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 @@ -526,6 +553,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -534,6 +562,7 @@ def update( 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'], @@ -541,7 +570,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -555,11 +588,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -582,17 +615,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -602,7 +642,7 @@ 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 @@ -629,17 +669,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -653,7 +700,7 @@ def get( 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 @@ -682,17 +729,24 @@ def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -706,5 +760,5 @@ def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_usage_operations.py index 1bb5e708f4d0..6d7661fdfc9d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extension_images_operations.py index 88eb1dd126ba..0263d9d1ddaf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extensions_operations.py index 324335d7c5e1..43763837b85b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,9 +127,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -137,16 +138,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -160,10 +161,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -171,23 +173,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -200,33 +202,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,6 +269,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -275,6 +279,7 @@ def _create_or_update_initial( 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'], @@ -282,7 +287,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -300,7 +309,7 @@ def _create_or_update_initial( 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 @@ -338,8 +347,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,6 +362,7 @@ 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 @@ -376,10 +387,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -395,6 +405,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -404,6 +415,7 @@ def _update_initial( 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'], @@ -411,7 +423,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -425,7 +441,7 @@ def _update_initial( 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 @@ -463,8 +479,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,6 +494,7 @@ 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 @@ -501,12 +519,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -519,18 +536,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -540,11 +564,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -571,7 +595,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -583,6 +608,7 @@ 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 ) @@ -603,10 +629,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -625,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) @@ -638,19 +663,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -664,7 +696,7 @@ def get( 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 @@ -681,7 +713,7 @@ 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) @@ -694,18 +726,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -719,5 +758,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_edge_zone_operations.py index 8c4659c162f0..f46d2e702768 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_edge_zone_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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}') + _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'), @@ -49,21 +50,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -81,10 +82,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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'), @@ -94,27 +96,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -126,10 +128,11 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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'), @@ -137,21 +140,21 @@ def build_list_offers_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,31 +165,32 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,10 +203,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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'), @@ -211,21 +216,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -287,6 +292,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( location=location, @@ -296,12 +303,17 @@ def get( 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(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]: @@ -316,7 +328,7 @@ def get( 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 @@ -345,12 +357,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) @@ -363,6 +376,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_list_request( location=location, @@ -371,6 +386,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -379,7 +395,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -394,7 +414,7 @@ def list( 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 @@ -425,18 +445,25 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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]: @@ -451,7 +478,7 @@ def list_offers( 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 @@ -478,17 +505,24 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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]: @@ -503,7 +537,7 @@ def list_publishers( 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 @@ -537,6 +571,8 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_list_skus_request( location=location, @@ -544,12 +580,17 @@ def list_skus( 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(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,5 +605,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_operations.py index 1d7a5164fdc5..de780c93101a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_run_commands_operations.py index a8ed3273b7c1..e3d9ba443688 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,31 +69,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -107,12 +109,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -120,23 +122,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -153,12 +155,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -166,23 +168,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -196,10 +198,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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}') + _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'), @@ -207,21 +210,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -235,10 +238,11 @@ def build_get_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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}') + _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'), @@ -246,23 +250,23 @@ def build_get_by_virtual_machine_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -275,33 +279,34 @@ def build_list_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -344,6 +349,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -355,6 +362,7 @@ def prepare_request(next_link=None): 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) @@ -365,6 +373,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -382,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]: @@ -395,7 +408,7 @@ def get_next(next_link=None): 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( @@ -421,17 +434,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -445,7 +465,7 @@ def get( 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( @@ -454,6 +474,8 @@ 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"] @@ -462,7 +484,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -471,6 +493,7 @@ def _create_or_update_initial( 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'], @@ -478,7 +501,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def _create_or_update_initial( 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 @@ -506,6 +533,8 @@ def begin_create_or_update( 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. @@ -519,6 +548,9 @@ 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_03_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 @@ -533,8 +565,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -548,6 +580,7 @@ def begin_create_or_update( 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 ) @@ -571,10 +604,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore def _update_initial( self, @@ -582,6 +614,8 @@ 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"] @@ -590,7 +624,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -599,6 +633,7 @@ def _update_initial( 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'], @@ -606,7 +641,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +659,7 @@ def _update_initial( 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 @@ -630,6 +669,8 @@ def begin_update( 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. @@ -642,6 +683,9 @@ 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_03_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 @@ -656,8 +700,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -671,6 +715,7 @@ def begin_update( 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 ) @@ -694,12 +739,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -712,18 +756,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -733,11 +784,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -764,7 +815,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -776,6 +828,7 @@ 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 ) @@ -796,10 +849,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get_by_virtual_machine( @@ -818,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) @@ -831,19 +883,26 @@ def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -858,7 +917,7 @@ def get_by_virtual_machine( 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 @@ -875,7 +934,7 @@ 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 @@ -884,6 +943,8 @@ def list_by_virtual_machine( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -896,6 +957,7 @@ def prepare_request(next_link=None): 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'], ) @@ -908,6 +970,7 @@ def prepare_request(next_link=None): 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, ) @@ -926,7 +989,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]: @@ -940,4 +1007,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_extensions_operations.py index 331bc708dd50..e12e960d23ec 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -336,8 +345,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -350,6 +360,7 @@ 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 @@ -374,10 +385,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore def _update_initial( self, @@ -393,6 +403,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -402,6 +413,7 @@ def _update_initial( 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'], @@ -409,7 +421,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,12 +521,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -521,18 +538,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -542,11 +566,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -573,7 +597,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -585,6 +610,7 @@ 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 ) @@ -605,10 +631,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -627,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) @@ -640,19 +665,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -666,7 +698,7 @@ def get( 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 @@ -689,6 +721,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -701,6 +735,7 @@ def prepare_request(next_link=None): 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) @@ -712,6 +747,7 @@ def prepare_request(next_link=None): 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) @@ -729,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]: @@ -742,4 +782,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 94cca0b85d54..9af7b2786d9f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,25 +33,26 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -62,25 +63,26 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -91,25 +93,26 @@ def build_start_extension_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -120,31 +123,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -170,7 +174,7 @@ 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: str, vm_scale_set_name: str, @@ -182,17 +186,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -202,11 +213,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -230,7 +241,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -241,6 +253,7 @@ 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 ) @@ -261,12 +274,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -278,17 +290,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,11 +317,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -328,7 +347,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -339,6 +359,7 @@ 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 ) @@ -359,12 +380,11 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def _start_extension_upgrade_initial( + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -376,17 +396,24 @@ def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -396,11 +423,11 @@ 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 @distributed_trace - def begin_start_extension_upgrade( + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -426,7 +453,8 @@ def begin_start_extension_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -437,6 +465,7 @@ 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 ) @@ -457,10 +486,9 @@ 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) + 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 + begin_start_extension_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -486,17 +514,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -510,5 +545,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 51bebf899a0f..69a0afe6e725 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -53,23 +53,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -87,12 +87,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -101,23 +101,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -132,10 +132,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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}') + _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'), @@ -144,21 +145,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -173,10 +174,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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}') + _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'), @@ -185,23 +187,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,10 +217,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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'), @@ -226,23 +229,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +286,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') @@ -293,6 +297,7 @@ def _create_or_update_initial( 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'], @@ -300,7 +305,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -359,8 +368,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -374,6 +384,7 @@ 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 @@ -398,10 +409,9 @@ 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) + 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 + 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, @@ -418,6 +428,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') @@ -428,6 +439,7 @@ def _update_initial( 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'], @@ -435,7 +447,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -449,7 +465,7 @@ def _update_initial( 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 @@ -490,8 +506,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -505,6 +522,7 @@ 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 @@ -529,12 +547,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -548,6 +565,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -555,12 +574,17 @@ def _delete_initial( 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) - 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]: @@ -570,11 +594,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -604,7 +628,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -617,6 +642,7 @@ 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 ) @@ -637,10 +663,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -662,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) @@ -675,6 +700,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -682,13 +709,18 @@ def get( 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) - 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]: @@ -703,7 +735,7 @@ def get( 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 @@ -723,7 +755,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) @@ -736,19 +768,26 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -763,5 +802,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index aa3076aa8656..10a7f671f0d8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -133,10 +133,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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}') + _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'), @@ -145,21 +146,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -174,10 +175,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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}') + _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'), @@ -186,23 +188,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -216,10 +218,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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'), @@ -227,23 +230,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -276,6 +279,8 @@ 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"] @@ -284,7 +289,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -294,6 +299,7 @@ def _create_or_update_initial( 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'], @@ -301,7 +307,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -319,7 +329,7 @@ def _create_or_update_initial( 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 @@ -330,6 +340,8 @@ def begin_create_or_update( 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. @@ -344,6 +356,9 @@ 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_03_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 @@ -358,8 +373,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -374,6 +389,7 @@ def begin_create_or_update( 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 ) @@ -397,10 +413,9 @@ 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) + 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 + 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, @@ -409,6 +424,8 @@ 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"] @@ -417,7 +434,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -427,6 +444,7 @@ def _update_initial( 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'], @@ -434,7 +452,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -448,7 +470,7 @@ def _update_initial( 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 @@ -459,6 +481,8 @@ def begin_update( 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. @@ -473,6 +497,9 @@ 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_03_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 @@ -487,8 +514,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -503,6 +530,7 @@ def begin_update( 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 ) @@ -526,12 +554,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -545,6 +572,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -552,12 +581,17 @@ def _delete_initial( 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) - 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]: @@ -567,11 +601,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -601,7 +635,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -614,6 +649,7 @@ 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 ) @@ -634,10 +670,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get( @@ -659,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) @@ -672,6 +707,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -679,13 +716,18 @@ def get( 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) - 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]: @@ -700,7 +742,7 @@ def get( 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 @@ -720,7 +762,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -729,6 +771,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -742,6 +786,7 @@ def prepare_request(next_link=None): 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'], ) @@ -755,6 +800,7 @@ def prepare_request(next_link=None): 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, ) @@ -773,7 +819,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]: @@ -787,4 +837,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vms_operations.py index 6ec180e88070..12fc4454d115 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,11 +39,11 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -51,22 +51,22 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,9 +80,10 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -90,16 +91,16 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -111,9 +112,10 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -121,16 +123,16 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -145,12 +147,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -158,23 +160,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -190,9 +192,10 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -200,18 +203,18 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -225,10 +228,11 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -236,23 +240,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -264,10 +268,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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'), @@ -275,21 +280,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -304,37 +309,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -348,9 +354,10 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -358,18 +365,18 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -381,9 +388,10 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -391,16 +399,16 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -412,9 +420,10 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -422,16 +431,16 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -443,9 +452,10 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -453,16 +463,16 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -476,10 +486,11 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-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') + _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'), @@ -487,23 +498,23 @@ def build_retrieve_boot_diagnostics_data_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -515,9 +526,10 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -525,16 +537,16 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -546,9 +558,10 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + _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'), @@ -556,16 +569,16 @@ def build_simulate_eviction_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -580,12 +593,12 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -593,29 +606,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -637,7 +650,7 @@ 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: str, vm_scale_set_name: str, @@ -651,6 +664,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -663,6 +677,7 @@ def _reimage_initial( 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'], @@ -670,7 +685,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -680,11 +699,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -701,6 +720,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -715,8 +735,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -729,6 +750,7 @@ 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 @@ -750,12 +772,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -768,18 +789,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -789,11 +817,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -821,7 +849,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,6 +862,7 @@ 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 ) @@ -853,12 +883,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -871,18 +900,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -892,11 +928,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -925,7 +961,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -937,6 +974,7 @@ 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 ) @@ -957,10 +995,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -976,6 +1013,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -985,6 +1023,7 @@ def _update_initial( 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'], @@ -992,7 +1031,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1010,7 +1053,7 @@ def _update_initial( 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 @@ -1047,8 +1090,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -1061,6 +1105,7 @@ 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 @@ -1085,12 +1130,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1104,19 +1148,26 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -1126,11 +1177,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1147,7 +1198,7 @@ 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. @@ -1161,7 +1212,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1174,6 +1226,7 @@ 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 ) @@ -1194,10 +1247,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1218,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_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSetVM, or the result of cls(response) @@ -1231,19 +1283,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -1257,7 +1316,7 @@ def get( 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 @@ -1287,18 +1346,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -1312,7 +1378,7 @@ def get_instance_view( 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 @@ -1333,12 +1399,13 @@ 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 @@ -1347,6 +1414,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1359,6 +1428,7 @@ def prepare_request(next_link=None): 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, @@ -1373,6 +1443,7 @@ def prepare_request(next_link=None): 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, @@ -1393,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]: @@ -1406,9 +1481,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1422,19 +1497,26 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -1444,11 +1526,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1468,7 +1550,7 @@ 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. @@ -1482,7 +1564,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1495,6 +1578,7 @@ 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 ) @@ -1515,12 +1599,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1533,18 +1616,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1554,11 +1644,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1585,7 +1675,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1597,6 +1688,7 @@ 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 ) @@ -1617,12 +1709,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1635,18 +1726,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1656,11 +1754,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1687,7 +1785,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1699,6 +1798,7 @@ 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 ) @@ -1719,12 +1819,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1737,18 +1836,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1758,11 +1864,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1790,7 +1896,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1802,6 +1909,7 @@ 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 ) @@ -1822,10 +1930,9 @@ 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) + 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 + 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( @@ -1847,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) @@ -1860,19 +1967,26 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-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) - 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]: @@ -1887,10 +2001,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1903,18 +2017,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1924,11 +2045,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1955,7 +2076,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1967,6 +2089,7 @@ 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 ) @@ -1987,13 +2110,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2019,18 +2141,25 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -2040,7 +2169,7 @@ 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( @@ -2049,6 +2178,8 @@ 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"]] @@ -2057,7 +2188,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2066,6 +2197,7 @@ def _run_command_initial( 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'], @@ -2073,7 +2205,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2089,7 +2225,7 @@ def _run_command_initial( 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 @@ -2099,6 +2235,8 @@ def begin_run_command( 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. @@ -2111,6 +2249,9 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_03_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 @@ -2124,8 +2265,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -2139,6 +2280,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2162,7 +2304,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_sets_operations.py index 399ec9978432..5943286fefaa 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -158,27 +159,28 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -191,33 +193,34 @@ def build_get_request( expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -231,33 +234,33 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -274,35 +277,35 @@ def build_delete_instances_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -315,31 +318,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -349,30 +353,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -381,29 +386,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -414,31 +420,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -449,31 +456,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -488,35 +496,35 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -532,33 +540,33 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -574,33 +582,33 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -616,33 +624,33 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -658,33 +666,33 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -700,33 +708,33 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -742,33 +750,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -784,33 +792,33 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -825,32 +833,33 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -864,33 +873,33 @@ def build_convert_to_single_placement_group_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -906,39 +915,39 @@ def build_set_orchestration_service_state_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -977,6 +986,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -988,6 +999,7 @@ def prepare_request(next_link=None): 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) @@ -998,6 +1010,7 @@ def prepare_request(next_link=None): 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) @@ -1015,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]: @@ -1029,7 +1046,7 @@ def get_next(next_link=None): 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, @@ -1044,6 +1061,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -1052,6 +1070,7 @@ def _create_or_update_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'], @@ -1059,7 +1078,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1077,7 +1100,7 @@ def _create_or_update_initial( 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 @@ -1110,8 +1133,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1123,6 +1147,7 @@ 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 @@ -1147,10 +1172,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -1165,6 +1189,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -1173,6 +1198,7 @@ def _update_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'], @@ -1180,7 +1206,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1194,7 +1224,7 @@ def _update_initial( 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 @@ -1227,8 +1257,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1240,6 +1271,7 @@ 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 @@ -1264,12 +1296,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1282,18 +1313,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1303,11 +1341,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1321,6 +1359,7 @@ 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. @@ -1334,7 +1373,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1346,6 +1386,7 @@ 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 ) @@ -1366,10 +1407,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1387,7 +1427,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_03_01.models.ExpandTypesForGetVMScaleSets :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineScaleSet, or the result of cls(response) @@ -1400,18 +1440,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -1425,10 +1472,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1441,6 +1488,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1452,6 +1500,7 @@ def _deallocate_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'], @@ -1459,7 +1508,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1469,11 +1522,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1488,7 +1541,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1503,8 +1557,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1516,6 +1571,7 @@ 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 @@ -1537,12 +1593,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1556,6 +1611,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1564,6 +1620,7 @@ def _delete_instances_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, @@ -1572,7 +1629,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1582,11 +1643,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1604,7 +1665,7 @@ def begin_delete_instances( :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs :param force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). + 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. @@ -1618,8 +1679,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1632,6 +1694,7 @@ 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 @@ -1653,10 +1716,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1682,17 +1744,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -1706,7 +1775,7 @@ def get_instance_view( 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 @@ -1726,6 +1795,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1737,6 +1808,7 @@ def prepare_request(next_link=None): 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) @@ -1747,6 +1819,7 @@ def prepare_request(next_link=None): 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) @@ -1764,7 +1837,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]: @@ -1777,7 +1854,7 @@ def get_next(next_link=None): 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( @@ -1795,6 +1872,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1805,6 +1884,7 @@ def prepare_request(next_link=None): 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) @@ -1814,6 +1894,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1831,7 +1912,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]: @@ -1844,7 +1929,7 @@ def get_next(next_link=None): 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( @@ -1867,6 +1952,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1879,6 +1966,7 @@ def prepare_request(next_link=None): 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) @@ -1890,6 +1978,7 @@ def prepare_request(next_link=None): 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) @@ -1907,7 +1996,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]: @@ -1920,7 +2013,7 @@ def get_next(next_link=None): 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( @@ -1942,6 +2035,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1954,6 +2049,7 @@ def prepare_request(next_link=None): 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) @@ -1965,6 +2061,7 @@ def prepare_request(next_link=None): 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) @@ -1982,7 +2079,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]: @@ -1995,9 +2096,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -2011,6 +2112,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2022,6 +2124,7 @@ def _power_off_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, @@ -2030,7 +2133,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2040,11 +2147,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2062,9 +2169,10 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2079,8 +2187,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2093,6 +2202,7 @@ 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 @@ -2114,12 +2224,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2132,6 +2241,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2143,6 +2253,7 @@ def _restart_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'], @@ -2150,7 +2261,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2160,11 +2275,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2177,7 +2292,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2192,8 +2308,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2205,6 +2322,7 @@ 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 @@ -2226,12 +2344,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2244,6 +2361,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2255,6 +2373,7 @@ def _start_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'], @@ -2262,7 +2381,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2272,11 +2395,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2289,7 +2412,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2304,8 +2428,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2317,6 +2442,7 @@ 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 @@ -2338,12 +2464,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2356,6 +2481,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2367,6 +2493,7 @@ def _redeploy_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'], @@ -2374,7 +2501,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2384,11 +2515,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2402,7 +2533,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2417,8 +2549,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2430,6 +2563,7 @@ 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 @@ -2451,12 +2585,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2469,6 +2602,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2480,6 +2614,7 @@ def _perform_maintenance_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'], @@ -2487,7 +2622,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2497,11 +2636,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2517,7 +2656,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2532,8 +2672,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2545,6 +2686,7 @@ 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 @@ -2566,12 +2708,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2584,6 +2725,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2592,6 +2734,7 @@ def _update_instances_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'], @@ -2599,7 +2742,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2609,11 +2756,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2641,8 +2788,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2654,6 +2802,7 @@ 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 @@ -2675,12 +2824,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2693,6 +2841,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -2704,6 +2853,7 @@ def _reimage_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'], @@ -2711,7 +2861,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2721,11 +2875,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2740,7 +2894,7 @@ 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. + :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_03_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -2755,8 +2909,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2768,6 +2923,7 @@ 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 @@ -2789,12 +2945,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2807,6 +2962,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2818,6 +2974,7 @@ def _reimage_all_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'], @@ -2825,7 +2982,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2835,11 +2996,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2853,7 +3014,8 @@ 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. + :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_03_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2868,8 +3030,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2881,6 +3044,7 @@ 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 @@ -2902,10 +3066,9 @@ 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) + 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 + 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( @@ -2936,18 +3099,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -2961,11 +3131,11 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2992,6 +3162,7 @@ def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -3000,6 +3171,7 @@ def convert_to_single_placement_group( 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'], @@ -3007,7 +3179,11 @@ def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3017,10 +3193,10 @@ 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: str, vm_scale_set_name: str, @@ -3033,6 +3209,7 @@ def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -3041,6 +3218,7 @@ def _set_orchestration_service_state_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'], @@ -3048,7 +3226,11 @@ def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3058,11 +3240,11 @@ 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 @distributed_trace - def begin_set_orchestration_service_state( + def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -3089,8 +3271,9 @@ def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -3102,6 +3285,7 @@ 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 @@ -3123,7 +3307,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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_sizes_operations.py index eff2cbff4fca..4e9a3fa1075c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,6 +99,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -109,6 +112,7 @@ def prepare_request(next_link=None): 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) @@ -119,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machines_operations.py index ff540d837fb5..d18ff885fd58 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -202,27 +203,28 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -235,33 +237,34 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -272,31 +275,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -307,25 +311,26 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -336,25 +341,26 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -365,25 +371,26 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -393,30 +400,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -427,31 +435,32 @@ def build_list_all_request( status_only: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -462,31 +471,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -499,27 +509,28 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -530,31 +541,32 @@ def build_reapply_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -565,25 +577,26 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -594,25 +607,26 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -623,25 +637,26 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -655,33 +670,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -696,33 +711,34 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -733,25 +749,26 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -762,25 +779,26 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -791,31 +809,32 @@ def build_assess_patches_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-03-01" + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -829,35 +848,35 @@ def build_install_patches_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -873,41 +892,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-03-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -946,6 +965,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -957,6 +978,7 @@ def prepare_request(next_link=None): 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) @@ -967,6 +989,7 @@ def prepare_request(next_link=None): 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) @@ -984,7 +1007,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]: @@ -997,7 +1024,7 @@ def get_next(next_link=None): 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, @@ -1012,6 +1039,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -1020,6 +1048,7 @@ def _capture_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'], @@ -1027,7 +1056,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1043,7 +1076,7 @@ def _capture_initial( 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 @@ -1077,8 +1110,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1090,6 +1124,7 @@ 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 @@ -1114,10 +1149,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -1132,6 +1166,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -1140,6 +1175,7 @@ def _create_or_update_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'], @@ -1147,7 +1183,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1165,7 +1205,7 @@ def _create_or_update_initial( 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 @@ -1198,8 +1238,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1211,6 +1252,7 @@ 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 @@ -1235,10 +1277,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1253,6 +1294,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1261,6 +1303,7 @@ def _update_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'], @@ -1268,7 +1311,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1282,7 +1329,7 @@ def _update_initial( 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 @@ -1314,8 +1361,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1327,6 +1375,7 @@ 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 @@ -1351,12 +1400,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1369,18 +1417,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -1390,11 +1445,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1407,7 +1462,8 @@ 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. @@ -1421,7 +1477,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1433,6 +1490,7 @@ 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 ) @@ -1453,10 +1511,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1476,6 +1533,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_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachine, or the result of cls(response) @@ -1488,18 +1546,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -1513,7 +1578,7 @@ def get( 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 @@ -1540,17 +1605,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -1564,10 +1636,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1579,17 +1651,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1599,11 +1678,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1628,7 +1707,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1639,6 +1719,7 @@ 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 ) @@ -1659,12 +1740,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1676,17 +1756,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1696,11 +1783,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1725,7 +1812,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1736,6 +1824,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1756,13 +1845,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1790,17 +1878,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -1810,7 +1905,7 @@ 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 @@ -1831,6 +1926,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1842,6 +1939,7 @@ def prepare_request(next_link=None): 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) @@ -1852,6 +1950,7 @@ def prepare_request(next_link=None): 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) @@ -1869,7 +1968,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]: @@ -1882,7 +1985,7 @@ def get_next(next_link=None): 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( @@ -1894,7 +1997,7 @@ 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 @@ -1903,6 +2006,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1913,6 +2018,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1923,6 +2029,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1941,7 +2048,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]: @@ -1954,7 +2065,7 @@ def get_next(next_link=None): 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( @@ -1977,6 +2088,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1989,6 +2102,7 @@ def prepare_request(next_link=None): 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) @@ -2000,6 +2114,7 @@ def prepare_request(next_link=None): 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) @@ -2017,7 +2132,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]: @@ -2030,9 +2149,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -2045,18 +2164,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -2066,11 +2192,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2086,7 +2212,7 @@ 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. @@ -2100,7 +2226,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2112,6 +2239,7 @@ 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 ) @@ -2132,12 +2260,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2149,17 +2276,24 @@ def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -2169,11 +2303,11 @@ 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 @distributed_trace - def begin_reapply( + def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2197,7 +2331,8 @@ def begin_reapply( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2208,6 +2343,7 @@ 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 ) @@ -2228,12 +2364,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2245,17 +2380,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -2265,11 +2407,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2293,7 +2435,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2304,6 +2447,7 @@ 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 ) @@ -2324,12 +2468,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2341,17 +2484,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -2361,11 +2511,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2389,7 +2539,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2400,6 +2551,7 @@ 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 ) @@ -2420,12 +2572,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2437,17 +2588,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -2457,11 +2615,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2485,7 +2643,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2496,6 +2655,7 @@ 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 ) @@ -2516,12 +2676,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2534,6 +2693,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -2545,6 +2705,7 @@ def _reimage_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'], @@ -2552,7 +2713,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2562,11 +2727,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2579,7 +2744,8 @@ 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_03_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2593,8 +2759,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2606,6 +2773,7 @@ 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 @@ -2627,10 +2795,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore @distributed_trace def retrieve_boot_diagnostics_data( @@ -2648,7 +2815,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) @@ -2661,18 +2828,25 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -2687,10 +2861,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2702,17 +2876,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -2722,11 +2903,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2750,7 +2931,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2761,6 +2943,7 @@ 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 ) @@ -2781,13 +2964,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2810,17 +2992,24 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str + 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) - 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]: @@ -2830,7 +3019,7 @@ 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( @@ -2845,17 +3034,24 @@ def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: 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) - 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]: @@ -2871,7 +3067,7 @@ def _assess_patches_initial( 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 @@ -2901,7 +3097,8 @@ def begin_assess_patches( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -2912,6 +3109,7 @@ 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 ) @@ -2935,10 +3133,9 @@ 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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore def _install_patches_initial( self, @@ -2953,6 +3150,7 @@ def _install_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') @@ -2961,6 +3159,7 @@ def _install_patches_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'], @@ -2968,7 +3167,11 @@ def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2984,7 +3187,7 @@ def _install_patches_initial( 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 @@ -3018,8 +3221,9 @@ def begin_install_patches( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstallPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-03-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -3031,6 +3235,7 @@ 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 @@ -3055,16 +3260,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) + 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 + 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: 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"]] @@ -3073,7 +3279,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-03-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -3081,6 +3287,7 @@ def _run_command_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'], @@ -3088,7 +3295,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3104,7 +3315,7 @@ def _run_command_initial( 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 @@ -3113,6 +3324,8 @@ def begin_run_command( 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. @@ -3123,6 +3336,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_03_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 @@ -3136,8 +3352,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-03-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( 'polling_interval', @@ -3150,6 +3366,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -3173,7 +3390,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_compute_management_client.py index aa4402b24a3a..4ca35de62b8c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -115,8 +116,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-04-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. """ @@ -170,7 +174,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_configuration.py index 691320acdacf..0b60eac1a830 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-04-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_metadata.json index 704303d6574f..c2b6b83b819a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_compute_management_client.py index becf9c0e22d0..2998d9edfb41 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -117,8 +118,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-04-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_configuration.py index 0daea53f7094..f4ca551da152 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/_configuration.py @@ -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-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-04-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_availability_sets_operations.py index cc877530387c..7206bc42302c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservation_groups_operations.py index 8b86fc6fab82..dbd6000abdb8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservation_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationGroup') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -139,6 +144,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') @@ -147,6 +153,7 @@ async def update( 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'], @@ -154,7 +161,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -168,11 +179,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -198,17 +209,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -218,7 +236,7 @@ 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 @@ -238,7 +256,7 @@ 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. + platform and can change outside of control plane operations. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response @@ -252,18 +270,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -277,7 +302,7 @@ async def get( 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 @@ -294,7 +319,7 @@ 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. + associated to capacity reservation group in the response. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response @@ -304,6 +329,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -315,6 +342,7 @@ def prepare_request(next_link=None): 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'], ) @@ -326,6 +354,7 @@ def prepare_request(next_link=None): 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, ) @@ -344,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]: @@ -357,7 +390,7 @@ async def get_next(next_link=None): 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( @@ -370,7 +403,7 @@ 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. + associated to capacity reservation group in the response. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response @@ -380,6 +413,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -390,6 +425,7 @@ def prepare_request(next_link=None): 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'], ) @@ -400,6 +436,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -418,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]: @@ -431,4 +472,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservations_operations.py index b0ce6e59d2d4..7e642c4b63e3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_capacity_reservations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservation') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -134,8 +139,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -148,6 +154,7 @@ 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 @@ -172,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore async def _update_initial( self, @@ -191,6 +197,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationUpdate') @@ -200,6 +207,7 @@ async def _update_initial( 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'], @@ -207,7 +215,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -223,7 +235,7 @@ async def _update_initial( 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 @@ -259,8 +271,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,6 +286,7 @@ 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 @@ -297,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -315,18 +328,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -336,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -369,7 +389,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -381,6 +402,7 @@ 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 ) @@ -401,10 +423,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore @distributed_trace_async async def get( @@ -425,7 +446,7 @@ 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. + and can change outside of control plane operations. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response @@ -439,19 +460,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -465,7 +493,7 @@ async def get( 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 @@ -489,6 +517,8 @@ def list_by_capacity_reservation_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -501,6 +531,7 @@ def prepare_request(next_link=None): 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) @@ -512,6 +543,7 @@ def prepare_request(next_link=None): 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) @@ -529,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]: @@ -542,4 +578,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_host_groups_operations.py index e75acad27bf6..0d835d81ae6b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -138,6 +143,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -146,6 +152,7 @@ async def update( 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'], @@ -153,7 +160,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -167,11 +178,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -194,17 +205,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -214,7 +232,7 @@ 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 @@ -233,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_04_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) @@ -246,18 +264,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -271,7 +296,7 @@ async def get( 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 @@ -292,6 +317,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -303,6 +330,7 @@ def prepare_request(next_link=None): 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) @@ -313,6 +341,7 @@ def prepare_request(next_link=None): 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) @@ -330,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]: @@ -343,7 +376,7 @@ async def get_next(next_link=None): 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( @@ -360,6 +393,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -370,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -379,6 +415,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -396,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]: @@ -409,4 +450,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_hosts_operations.py index ac01e89713a4..d143925a8426 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -255,8 +267,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,6 +282,7 @@ 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 @@ -293,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -311,18 +324,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -332,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -363,7 +383,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -375,6 +396,7 @@ 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 ) @@ -395,10 +417,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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_04_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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -482,6 +510,8 @@ def list_by_host_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -494,6 +524,7 @@ def prepare_request(next_link=None): 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) @@ -505,6 +536,7 @@ def prepare_request(next_link=None): 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) @@ -522,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]: @@ -535,4 +571,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_accesses_operations.py index 9819d0bd6b5e..2882235a4b6a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace_async async def get_private_link_resources( @@ -602,17 +646,24 @@ async def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -626,7 +677,7 @@ async def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore async def _update_a_private_endpoint_connection_initial( @@ -643,6 +694,7 @@ async def _update_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -652,6 +704,7 @@ async def _update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], @@ -659,7 +712,11 @@ async def _update_a_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -677,7 +734,7 @@ async def _update_a_private_endpoint_connection_initial( return deserialized - _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -718,8 +775,9 @@ async def begin_update_a_private_endpoint_connection( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -732,6 +790,7 @@ async def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -756,10 +815,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_update_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async async def get_a_private_endpoint_connection( @@ -790,18 +848,25 @@ async def get_a_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_a_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_a_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -815,10 +880,10 @@ async def get_a_private_endpoint_connection( return deserialized - get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - async def _delete_a_private_endpoint_connection_initial( + async def _delete_a_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -831,18 +896,25 @@ async def _delete_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_a_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -852,11 +924,11 @@ async def _delete_a_private_endpoint_connection_initial( if cls: return cls(pipeline_response, None, {}) - _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete_a_private_endpoint_connection( + async def begin_delete_a_private_endpoint_connection( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -885,7 +957,8 @@ async def begin_delete_a_private_endpoint_connection( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -897,6 +970,7 @@ async def begin_delete_a_private_endpoint_connection( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -917,10 +991,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_private_endpoint_connections( @@ -944,6 +1017,8 @@ def list_private_endpoint_connections( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -956,6 +1031,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) @@ -967,6 +1043,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -984,7 +1061,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]: @@ -997,4 +1078,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_encryption_sets_operations.py index 23e7c9873e2d..16f86202c65f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -130,8 +135,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -167,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -193,6 +200,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,7 +230,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -254,8 +266,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,6 +280,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -291,10 +305,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async async def get( @@ -322,17 +335,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -346,10 +366,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -361,17 +381,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -381,11 +408,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -411,7 +438,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -422,6 +450,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -442,10 +471,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -464,6 +492,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -475,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -485,6 +516,7 @@ def prepare_request(next_link=None): 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) @@ -502,7 +534,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]: @@ -515,7 +551,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -531,6 +567,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -541,6 +579,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -550,6 +589,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -567,7 +607,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]: @@ -580,7 +624,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -603,6 +647,8 @@ def list_associated_resources( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -615,6 +661,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -626,6 +673,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -643,7 +691,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]: @@ -656,4 +708,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_restore_point_operations.py index e5c067a3c176..7e757f521661 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disk_restore_point_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -80,6 +79,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -87,12 +88,17 @@ async def get( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_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) - 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]: @@ -106,7 +112,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}"} # type: ignore @distributed_trace @@ -134,6 +140,8 @@ def list_by_restore_point( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -147,6 +155,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=self.list_by_restore_point.metadata['url'], ) request = _convert_request(request) @@ -159,6 +168,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -176,7 +186,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]: @@ -189,7 +203,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + list_by_restore_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints"} # type: ignore async def _grant_access_initial( self, @@ -206,6 +220,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -216,6 +231,7 @@ async def _grant_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -223,7 +239,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -239,7 +259,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -280,8 +300,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,6 +316,7 @@ async def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -319,12 +341,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -338,6 +359,8 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, @@ -345,12 +368,17 @@ async def _revoke_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -360,11 +388,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -396,7 +424,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -409,6 +438,7 @@ async def begin_revoke_access( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -429,7 +459,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disks_operations.py index 013e4eb06e44..1e5c338a0408 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_images_operations.py index 14c7187f1c49..80462b6f5d50 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_log_analytics_operations.py index ac8cd16e0e2b..1e23acce3788 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_operations.py index 71fa0253a8f9..5f722c6ba4fc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_proximity_placement_groups_operations.py index 82231eca6c01..b860ebb88b67 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -230,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) @@ -243,18 +261,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -268,7 +293,7 @@ async def get( 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 @@ -285,6 +310,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -295,6 +322,7 @@ def prepare_request(next_link=None): 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) @@ -304,6 +332,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -321,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]: @@ -334,7 +367,7 @@ async def get_next(next_link=None): 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( @@ -353,6 +386,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +399,7 @@ def prepare_request(next_link=None): 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) @@ -374,6 +410,7 @@ def prepare_request(next_link=None): 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) @@ -391,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]: @@ -404,4 +445,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_point_collections_operations.py index b7c2709e5503..58f91d7b6938 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_point_collections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -78,6 +77,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollection') @@ -86,6 +86,7 @@ async def create_or_update( 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'], @@ -93,7 +94,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -111,7 +116,7 @@ async def create_or_update( 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 @@ -141,6 +146,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') @@ -149,6 +155,7 @@ async def update( 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'], @@ -156,7 +163,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -170,10 +181,10 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -185,17 +196,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -205,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -234,7 +252,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +264,7 @@ 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 ) @@ -265,10 +285,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore @distributed_trace_async async def get( @@ -285,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_04_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) @@ -298,18 +317,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -323,7 +349,7 @@ async def get( 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 @@ -343,6 +369,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -354,6 +382,7 @@ def prepare_request(next_link=None): 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) @@ -364,6 +393,7 @@ def prepare_request(next_link=None): 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) @@ -381,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]: @@ -394,7 +428,7 @@ async def get_next(next_link=None): 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( @@ -412,6 +446,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -422,6 +458,7 @@ def prepare_request(next_link=None): 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) @@ -431,6 +468,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -448,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]: @@ -461,4 +503,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_points_operations.py index 4089a9a32347..9c4aa554ebcd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_restore_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePoint') @@ -69,6 +69,7 @@ async def _create_initial( 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'], @@ -76,7 +77,11 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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 [201]: @@ -90,7 +95,7 @@ async def _create_initial( 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 @@ -126,8 +131,9 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.RestorePoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,12 +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) + 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 + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -182,18 +188,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -203,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -234,7 +247,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -246,6 +260,7 @@ 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 ) @@ -266,10 +281,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore @distributed_trace_async async def get( @@ -298,18 +312,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -323,5 +344,5 @@ async def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_snapshots_operations.py index 663eae3a14c8..b3eb10d13bc3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_ssh_public_keys_operations.py index fcf842cae964..19acb4a0cfb7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -71,6 +72,7 @@ def prepare_request(next_link=None): 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) @@ -80,6 +82,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -97,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]: @@ -110,7 +117,7 @@ async def get_next(next_link=None): 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( @@ -130,6 +137,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -141,6 +150,7 @@ def prepare_request(next_link=None): 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) @@ -151,6 +161,7 @@ def prepare_request(next_link=None): 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) @@ -168,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]: @@ -181,7 +196,7 @@ async def get_next(next_link=None): 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( @@ -210,6 +225,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -218,6 +234,7 @@ async def create( 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'], @@ -225,7 +242,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -243,7 +264,7 @@ async def create( 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 @@ -273,6 +294,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -281,6 +303,7 @@ async def update( 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'], @@ -288,7 +311,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +329,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -329,17 +356,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -349,7 +383,7 @@ 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 @@ -376,17 +410,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -400,7 +441,7 @@ async def get( 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 @@ -429,17 +470,24 @@ async def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -453,5 +501,5 @@ async def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_usage_operations.py index e37049646f2a..e2742b0f251e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extension_images_operations.py index 9e9cbd6df70f..796726e6e7b9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extensions_operations.py index 080164202f5b..c1f423aa313c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_edge_zone_operations.py index 1406f0781ebb..d3b30c376f7c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_edge_zone_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -80,6 +79,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( location=location, @@ -89,12 +90,17 @@ async def get( 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(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,7 +114,7 @@ async def get( 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 @@ -137,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) @@ -155,6 +162,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_list_request( location=location, @@ -163,6 +172,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -171,7 +181,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -185,7 +199,7 @@ async def list( 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 @@ -216,18 +230,25 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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]: @@ -241,7 +262,7 @@ async def list_offers( 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 @@ -268,17 +289,24 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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,7 +320,7 @@ async def list_publishers( 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 @@ -326,6 +354,8 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_list_skus_request( location=location, @@ -333,12 +363,17 @@ async def list_skus( 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(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]: @@ -352,5 +387,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_operations.py index 6283d52c646a..512d8f105fdc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_run_commands_operations.py index 8815f4e5fc63..46466943b0cc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -65,6 +64,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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( @@ -142,17 +149,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -166,7 +180,7 @@ async def get( 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( @@ -175,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"] @@ -183,7 +199,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -192,6 +208,7 @@ async def _create_or_update_initial( 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'], @@ -199,7 +216,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -217,7 +238,7 @@ async def _create_or_update_initial( 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 @@ -227,6 +248,8 @@ async def begin_create_or_update( 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. @@ -240,6 +263,9 @@ 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_04_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 @@ -254,8 +280,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -269,6 +295,7 @@ async def begin_create_or_update( 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 ) @@ -292,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore async def _update_initial( self, @@ -303,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"] @@ -311,7 +339,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -320,6 +348,7 @@ async def _update_initial( 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'], @@ -327,7 +356,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,7 +374,7 @@ async def _update_initial( 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 @@ -351,6 +384,8 @@ async def begin_update( 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. @@ -363,6 +398,9 @@ 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_04_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 @@ -377,8 +415,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -392,6 +430,7 @@ async def begin_update( 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 ) @@ -415,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -433,18 +471,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -454,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -485,7 +530,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -497,6 +543,7 @@ 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 ) @@ -517,10 +564,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) + 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 + 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( @@ -539,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) @@ -552,19 +598,26 @@ async def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -578,7 +631,7 @@ async def get_by_virtual_machine( 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 @@ -595,7 +648,7 @@ 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 @@ -604,6 +657,8 @@ def list_by_virtual_machine( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -616,6 +671,7 @@ def prepare_request(next_link=None): 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'], ) @@ -628,6 +684,7 @@ def prepare_request(next_link=None): 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, ) @@ -646,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]: @@ -659,4 +720,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index e143ce7a8429..bc1d5a471c50 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore async def _update_initial( self, @@ -192,6 +198,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -201,6 +208,7 @@ async def _update_initial( 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'], @@ -208,7 +216,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -264,8 +276,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,6 +291,7 @@ 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 @@ -302,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -320,18 +333,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -341,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -372,7 +392,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -384,6 +405,7 @@ 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 ) @@ -404,10 +426,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -426,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) @@ -439,19 +460,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -465,7 +493,7 @@ async def get( 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 @@ -488,6 +516,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -500,6 +530,7 @@ def prepare_request(next_link=None): 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) @@ -511,6 +542,7 @@ def prepare_request(next_link=None): 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) @@ -528,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]: @@ -541,4 +577,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 388855287dcf..a285933498a3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,12 +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) + 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 + 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, @@ -252,17 +267,24 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -272,11 +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 @distributed_trace_async - async def begin_start_extension_upgrade( + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -302,7 +324,8 @@ async def begin_start_extension_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,6 +336,7 @@ 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 ) @@ -333,10 +357,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) + 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 + 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( @@ -362,17 +385,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -386,5 +416,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index b896ef3b1073..d4271dce1513 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -152,6 +158,7 @@ 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 @@ -176,10 +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) + 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 + 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, @@ -196,6 +202,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') @@ -206,6 +213,7 @@ async def _update_initial( 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'], @@ -213,7 +221,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +239,7 @@ async def _update_initial( 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 @@ -268,8 +280,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,6 +296,7 @@ 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 @@ -307,12 +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) + 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 + 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, @@ -326,6 +339,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -333,12 +348,17 @@ async def _delete_initial( 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) - 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]: @@ -348,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -382,7 +402,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,6 +416,7 @@ 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 ) @@ -415,10 +437,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) + 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 + 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( @@ -440,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) @@ -453,6 +474,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -460,13 +483,18 @@ async def get( 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) - 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]: @@ -480,7 +508,7 @@ async def get( 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 @@ -500,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) @@ -513,19 +541,26 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -539,5 +574,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 8ccfac8d7b5a..4171bb0493dd 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -55,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"] @@ -63,7 +64,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -73,6 +74,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +82,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -98,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -109,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. @@ -123,6 +131,9 @@ 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_04_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 @@ -137,8 +148,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -153,6 +164,7 @@ async def begin_create_or_update( 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 ) @@ -176,10 +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) + 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 + 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, @@ -188,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"] @@ -196,7 +209,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -206,6 +219,7 @@ async def _update_initial( 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'], @@ -213,7 +227,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +245,7 @@ async def _update_initial( 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 @@ -238,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. @@ -252,6 +272,9 @@ 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_04_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 @@ -266,8 +289,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -282,6 +305,7 @@ async def begin_update( 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 ) @@ -305,12 +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) + 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 + 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, @@ -324,6 +347,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -331,12 +356,17 @@ async def _delete_initial( 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) - 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]: @@ -346,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -380,7 +410,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,6 +424,7 @@ 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 ) @@ -413,10 +445,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) + 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 + 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( @@ -438,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) @@ -451,6 +482,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -458,13 +491,18 @@ async def get( 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) - 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]: @@ -478,7 +516,7 @@ async def get( 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 @@ -498,7 +536,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -507,6 +545,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -520,6 +560,7 @@ def prepare_request(next_link=None): 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'], ) @@ -533,6 +574,7 @@ def prepare_request(next_link=None): 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, ) @@ -551,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]: @@ -564,4 +610,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index 3ce60a5f80e7..e2c3f7124125 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -62,6 +61,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -74,6 +74,7 @@ async def _reimage_initial( 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'], @@ -81,7 +82,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -112,6 +117,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -126,8 +132,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +147,7 @@ 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 @@ -161,12 +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) + 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 + 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, @@ -179,18 +186,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -200,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -232,7 +246,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -244,6 +259,7 @@ 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 ) @@ -264,12 +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) + 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 + 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, @@ -282,18 +297,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -303,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,7 +358,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -348,6 +371,7 @@ 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 ) @@ -368,10 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -387,6 +410,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -396,6 +420,7 @@ async def _update_initial( 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'], @@ -403,7 +428,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -421,7 +450,7 @@ async def _update_initial( 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 @@ -458,8 +487,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +502,7 @@ 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 @@ -496,12 +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) + 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 + 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, @@ -515,19 +545,26 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -537,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -558,7 +595,7 @@ 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. @@ -572,7 +609,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -585,6 +623,7 @@ 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 ) @@ -605,10 +644,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -629,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_04_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) @@ -642,19 +680,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -668,7 +713,7 @@ async def get( 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 @@ -698,18 +743,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -723,7 +775,7 @@ async def get_instance_view( 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 @@ -744,12 +796,13 @@ 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 @@ -758,6 +811,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -770,6 +825,7 @@ def prepare_request(next_link=None): 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, @@ -784,6 +840,7 @@ def prepare_request(next_link=None): 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, @@ -804,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]: @@ -817,9 +878,9 @@ async def get_next(next_link=None): 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, @@ -833,19 +894,26 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -855,11 +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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -879,7 +947,7 @@ 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. @@ -893,7 +961,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -906,6 +975,7 @@ 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 ) @@ -926,12 +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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -944,18 +1013,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -965,11 +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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -996,7 +1072,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1008,6 +1085,7 @@ 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 ) @@ -1028,12 +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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1046,18 +1123,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1067,11 +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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1098,7 +1182,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1110,6 +1195,7 @@ 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 ) @@ -1130,12 +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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1148,18 +1233,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1169,11 +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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1201,7 +1293,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1213,6 +1306,7 @@ 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 ) @@ -1233,10 +1327,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) + 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 + 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( @@ -1258,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) @@ -1271,19 +1364,26 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -1297,10 +1397,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + 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( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1313,18 +1413,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1334,11 +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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1365,7 +1472,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1377,6 +1485,7 @@ 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 ) @@ -1397,13 +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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1429,18 +1537,25 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -1450,7 +1565,7 @@ 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( @@ -1459,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"]] @@ -1467,7 +1584,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1476,6 +1593,7 @@ async def _run_command_initial( 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'], @@ -1483,7 +1601,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1499,7 +1621,7 @@ async def _run_command_initial( 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 @@ -1509,6 +1631,8 @@ async def begin_run_command( 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. @@ -1521,6 +1645,9 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_04_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 @@ -1535,8 +1662,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -1550,6 +1677,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1573,7 +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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_sets_operations.py index 15bfc5baeb48..7dabca0368df 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -139,6 +147,7 @@ async def _create_or_update_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'], @@ -146,7 +155,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -164,7 +177,7 @@ async def _create_or_update_initial( 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 @@ -197,8 +210,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -210,6 +224,7 @@ 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 @@ -234,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -252,6 +266,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -260,6 +275,7 @@ async def _update_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'], @@ -267,7 +283,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -281,7 +301,7 @@ async def _update_initial( 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 @@ -314,8 +334,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -327,6 +348,7 @@ 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 @@ -351,12 +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) + 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 + 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, @@ -369,18 +390,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -390,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -408,6 +436,7 @@ 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. @@ -421,7 +450,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -433,6 +463,7 @@ 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 ) @@ -453,10 +484,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -474,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_04_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) @@ -487,18 +517,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -512,10 +549,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -528,6 +565,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -539,6 +577,7 @@ async def _deallocate_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'], @@ -546,7 +585,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -556,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -575,7 +618,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -590,8 +634,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -603,6 +648,7 @@ 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 @@ -624,12 +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) + 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 + 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, @@ -643,6 +688,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -651,6 +697,7 @@ async def _delete_instances_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, @@ -659,7 +706,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -669,11 +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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -691,7 +742,7 @@ async def begin_delete_instances( :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs :param force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). + 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. @@ -705,8 +756,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -719,6 +771,7 @@ 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 @@ -740,10 +793,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) + 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 + 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( @@ -769,17 +821,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -793,7 +852,7 @@ async def get_instance_view( 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 @@ -813,6 +872,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -824,6 +885,7 @@ def prepare_request(next_link=None): 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) @@ -834,6 +896,7 @@ def prepare_request(next_link=None): 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) @@ -851,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]: @@ -864,7 +931,7 @@ async def get_next(next_link=None): 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( @@ -882,6 +949,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -892,6 +961,7 @@ def prepare_request(next_link=None): 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) @@ -901,6 +971,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -918,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]: @@ -931,7 +1006,7 @@ async def get_next(next_link=None): 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( @@ -954,6 +1029,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -966,6 +1043,7 @@ def prepare_request(next_link=None): 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) @@ -977,6 +1055,7 @@ def prepare_request(next_link=None): 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) @@ -994,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]: @@ -1007,7 +1090,7 @@ async def get_next(next_link=None): 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( @@ -1029,6 +1112,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1041,6 +1126,7 @@ def prepare_request(next_link=None): 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) @@ -1052,6 +1138,7 @@ def prepare_request(next_link=None): 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) @@ -1069,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]: @@ -1082,9 +1173,9 @@ async def get_next(next_link=None): 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, @@ -1098,6 +1189,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1109,6 +1201,7 @@ async def _power_off_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, @@ -1117,7 +1210,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1127,11 +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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1149,9 +1246,10 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1166,8 +1264,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1180,6 +1279,7 @@ 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 @@ -1201,12 +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) + 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 + 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, @@ -1219,6 +1318,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1230,6 +1330,7 @@ async def _restart_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'], @@ -1237,7 +1338,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1247,11 +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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1264,7 +1369,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1279,8 +1385,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1292,6 +1399,7 @@ 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 @@ -1313,12 +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) + 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 + 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, @@ -1331,6 +1438,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1342,6 +1450,7 @@ async def _start_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'], @@ -1349,7 +1458,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1359,11 +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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1376,7 +1489,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1391,8 +1505,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1404,6 +1519,7 @@ 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 @@ -1425,12 +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) + 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 + 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, @@ -1443,6 +1558,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1454,6 +1570,7 @@ async def _redeploy_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'], @@ -1461,7 +1578,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1471,11 +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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1489,7 +1610,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1504,8 +1626,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1517,6 +1640,7 @@ 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 @@ -1538,12 +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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1556,6 +1679,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1567,6 +1691,7 @@ async def _perform_maintenance_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'], @@ -1574,7 +1699,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1584,11 +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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1604,7 +1733,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1619,8 +1749,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1632,6 +1763,7 @@ 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 @@ -1653,12 +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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1671,6 +1802,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1679,6 +1811,7 @@ async def _update_instances_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'], @@ -1686,7 +1819,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1696,11 +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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1728,8 +1865,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1741,6 +1879,7 @@ 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 @@ -1762,12 +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) + 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 + 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, @@ -1780,6 +1918,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -1791,6 +1930,7 @@ async def _reimage_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'], @@ -1798,7 +1938,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1808,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1827,7 +1971,7 @@ 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. + :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_04_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -1842,8 +1986,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1855,6 +2000,7 @@ 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 @@ -1876,12 +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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1894,6 +2039,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1905,6 +2051,7 @@ async def _reimage_all_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'], @@ -1912,7 +2059,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1922,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1940,7 +2091,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1955,8 +2107,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1968,6 +2121,7 @@ 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 @@ -1989,10 +2143,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) + 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 + 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( @@ -2023,18 +2176,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -2048,11 +2208,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + async def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2079,6 +2239,7 @@ async def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2087,6 +2248,7 @@ async def convert_to_single_placement_group( 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'], @@ -2094,7 +2256,11 @@ async def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2104,10 +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, @@ -2120,6 +2286,7 @@ async def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -2128,6 +2295,7 @@ async def _set_orchestration_service_state_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'], @@ -2135,7 +2303,11 @@ async def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2145,11 +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 @distributed_trace_async - async def begin_set_orchestration_service_state( + async def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2176,8 +2348,9 @@ async def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2189,6 +2362,7 @@ 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 @@ -2210,7 +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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_sizes_operations.py index bb5786f76405..b0c556d2b62b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -64,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -85,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -102,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]: @@ -115,4 +121,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machines_operations.py index f7248ee62104..2521c653ef27 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -318,8 +338,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,6 +352,7 @@ 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 @@ -355,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -373,6 +394,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -381,6 +403,7 @@ async def _update_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'], @@ -388,7 +411,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -402,7 +429,7 @@ async def _update_initial( 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 @@ -435,8 +462,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -448,6 +476,7 @@ 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 @@ -472,12 +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) + 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 + 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, @@ -490,18 +518,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -511,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -528,7 +563,8 @@ 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. @@ -542,7 +578,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -554,6 +591,7 @@ 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 ) @@ -574,10 +612,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -597,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_04_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) @@ -609,18 +647,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -634,7 +679,7 @@ async def get( 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 @@ -661,17 +706,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -685,10 +737,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -700,17 +752,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -720,11 +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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -749,7 +808,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -760,6 +820,7 @@ 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 ) @@ -780,12 +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) + 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 + 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, @@ -797,17 +857,24 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -817,11 +884,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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -846,7 +913,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -857,6 +925,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -877,13 +946,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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -911,17 +979,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -931,7 +1006,7 @@ 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 @@ -952,6 +1027,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -963,6 +1040,7 @@ def prepare_request(next_link=None): 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) @@ -973,6 +1051,7 @@ def prepare_request(next_link=None): 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) @@ -990,7 +1069,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]: @@ -1003,7 +1086,7 @@ async def get_next(next_link=None): 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( @@ -1015,7 +1098,7 @@ 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 @@ -1024,6 +1107,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1034,6 +1119,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1044,6 +1130,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1062,7 +1149,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,7 +1166,7 @@ async def get_next(next_link=None): 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( @@ -1098,6 +1189,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1110,6 +1203,7 @@ def prepare_request(next_link=None): 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) @@ -1121,6 +1215,7 @@ def prepare_request(next_link=None): 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) @@ -1138,7 +1233,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]: @@ -1151,9 +1250,9 @@ async def get_next(next_link=None): 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, @@ -1166,18 +1265,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -1187,11 +1293,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1207,7 +1313,7 @@ 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. @@ -1221,7 +1327,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1233,6 +1340,7 @@ 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 ) @@ -1253,12 +1361,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _reapply_initial( + async def _reapply_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1270,17 +1377,24 @@ async def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -1290,11 +1404,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 @distributed_trace_async - async def begin_reapply( + async def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1318,7 +1432,8 @@ async def begin_reapply( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1329,6 +1444,7 @@ 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 ) @@ -1349,12 +1465,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) + 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 + begin_reapply.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1366,17 +1481,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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,11 +1508,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1414,7 +1536,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1425,6 +1548,7 @@ 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 ) @@ -1445,12 +1569,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) + 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 + 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, @@ -1462,17 +1585,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -1482,11 +1612,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1510,7 +1640,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1521,6 +1652,7 @@ 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 ) @@ -1541,12 +1673,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) + 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 + 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, @@ -1558,17 +1689,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -1578,11 +1716,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1606,7 +1744,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1617,6 +1756,7 @@ 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 ) @@ -1637,12 +1777,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) + 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 + 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, @@ -1655,6 +1794,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1666,6 +1806,7 @@ async def _reimage_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'], @@ -1673,7 +1814,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1683,11 +1828,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1700,7 +1845,8 @@ 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_04_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1714,8 +1860,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1727,6 +1874,7 @@ 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 @@ -1748,10 +1896,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) + 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 + 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( @@ -1769,7 +1916,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) @@ -1782,18 +1929,25 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -1807,10 +1961,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1822,17 +1976,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -1842,11 +2003,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1870,7 +2031,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1881,6 +2043,7 @@ 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 ) @@ -1901,13 +2064,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1930,17 +2092,24 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -1950,7 +2119,7 @@ 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( @@ -1965,17 +2134,24 @@ async def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -1991,7 +2167,7 @@ async def _assess_patches_initial( 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 @@ -2021,7 +2197,8 @@ async def begin_assess_patches( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -2032,6 +2209,7 @@ 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 ) @@ -2055,10 +2233,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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore async def _install_patches_initial( self, @@ -2073,6 +2250,7 @@ async def _install_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') @@ -2081,6 +2259,7 @@ async def _install_patches_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'], @@ -2088,7 +2267,11 @@ async def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2104,7 +2287,7 @@ async def _install_patches_initial( 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 @@ -2138,8 +2321,9 @@ async def begin_install_patches( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineInstallPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2151,6 +2335,7 @@ 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 @@ -2175,16 +2360,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) + 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 + 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"]] @@ -2193,7 +2379,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2201,6 +2387,7 @@ async def _run_command_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'], @@ -2208,7 +2395,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2224,7 +2415,7 @@ async def _run_command_initial( 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 @@ -2233,6 +2424,8 @@ async def begin_run_command( 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. @@ -2243,6 +2436,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_04_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 @@ -2257,8 +2453,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_04_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -2271,6 +2467,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2294,7 +2491,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_compute_management_client_enums.py index f39e7fdd9b25..af963f3ae018 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_compute_management_client_enums.py @@ -404,7 +404,6 @@ class OrchestrationServiceNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enu """ AUTOMATIC_REPAIRS = "AutomaticRepairs" - DUMMY_ORCHESTRATION_SERVICE_NAME = "DummyOrchestrationServiceName" class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_models_py3.py index 5bcc3bc084f5..246a9b09de0e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/models/_models_py3.py @@ -5880,7 +5880,7 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2021_04_01.models.OrchestrationServiceNames :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". @@ -5906,7 +5906,7 @@ def __init__( ): """ :keyword service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :paramtype service_name: str or ~azure.mgmt.compute.v2021_04_01.models.OrchestrationServiceNames :keyword action: Required. The action to be performed. Possible values include: "Resume", @@ -5924,8 +5924,7 @@ class OrchestrationServiceSummary(msrest.serialization.Model): 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". + :ivar service_name: The name of the service. Possible values include: "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2021_04_01.models.OrchestrationServiceNames :ivar service_state: The current state of the service. Possible values include: "NotRunning", "Running", "Suspended". diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_availability_sets_operations.py index b8d8bd5221e9..84d30f173d44 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -185,31 +187,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -253,31 +257,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,6 +335,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -338,6 +344,7 @@ def create_or_update( 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'], @@ -345,7 +352,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -359,7 +370,7 @@ def create_or_update( 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 @@ -389,6 +400,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -397,6 +409,7 @@ def update( 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'], @@ -404,7 +417,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +435,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -445,17 +462,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -465,7 +489,7 @@ 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 @@ -492,17 +516,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -516,7 +547,7 @@ def get( 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 @@ -528,7 +559,7 @@ 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 @@ -537,6 +568,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -547,6 +580,7 @@ def prepare_request(next_link=None): 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'], ) @@ -557,6 +591,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -575,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]: @@ -588,7 +627,7 @@ def get_next(next_link=None): 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( @@ -607,6 +646,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -618,6 +659,7 @@ def prepare_request(next_link=None): 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) @@ -628,6 +670,7 @@ def prepare_request(next_link=None): 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) @@ -645,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]: @@ -658,7 +705,7 @@ def get_next(next_link=None): 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( @@ -681,6 +728,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservation_groups_operations.py index 459178c69f39..8f3a8bad4b45 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservation_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,31 +121,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,33 +159,34 @@ def build_get_request( expand: Optional[Union[str, "_models.CapacityReservationGroupInstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,32 +198,33 @@ def build_list_by_resource_group_request( expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -232,31 +235,32 @@ def build_list_by_subscription_request( expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -311,6 +315,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationGroup') @@ -319,6 +324,7 @@ def create_or_update( 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'], @@ -326,7 +332,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -344,7 +354,7 @@ def create_or_update( 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 @@ -375,6 +385,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') @@ -383,6 +394,7 @@ def update( 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'], @@ -390,7 +402,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -404,11 +420,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -434,17 +450,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -454,7 +477,7 @@ 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 @@ -474,7 +497,7 @@ 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. + platform and can change outside of control plane operations. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response @@ -488,18 +511,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -513,7 +543,7 @@ def get( 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 @@ -530,7 +560,7 @@ 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. + associated to capacity reservation group in the response. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response @@ -540,6 +570,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -551,6 +583,7 @@ def prepare_request(next_link=None): 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'], ) @@ -562,6 +595,7 @@ def prepare_request(next_link=None): 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, ) @@ -580,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]: @@ -593,7 +631,7 @@ def get_next(next_link=None): 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( @@ -606,7 +644,7 @@ 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. + associated to capacity reservation group in the response. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response @@ -616,6 +654,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -626,6 +666,7 @@ def prepare_request(next_link=None): 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'], ) @@ -636,6 +677,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -654,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]: @@ -667,4 +713,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservations_operations.py index 27873d7ad5a1..f27695b3a775 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_capacity_reservations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + _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'), @@ -139,21 +140,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -167,10 +168,11 @@ def build_get_request( expand: Optional[Union[str, "_models.CapacityReservationInstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + _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'), @@ -178,23 +180,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -205,31 +207,32 @@ def build_list_by_capacity_reservation_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -269,6 +272,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservation') @@ -278,6 +282,7 @@ def _create_or_update_initial( 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'], @@ -285,7 +290,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -303,7 +312,7 @@ def _create_or_update_initial( 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 @@ -341,8 +350,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -355,6 +365,7 @@ 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 @@ -379,10 +390,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore def _update_initial( self, @@ -398,6 +408,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationUpdate') @@ -407,6 +418,7 @@ def _update_initial( 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'], @@ -414,7 +426,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -430,7 +446,7 @@ def _update_initial( 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 @@ -466,8 +482,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.CapacityReservation] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -480,6 +497,7 @@ 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 @@ -504,12 +522,11 @@ 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) + 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 + 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: str, capacity_reservation_group_name: str, @@ -522,18 +539,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -543,11 +567,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -576,7 +600,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -588,6 +613,7 @@ 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 ) @@ -608,10 +634,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore @distributed_trace def get( @@ -632,7 +657,7 @@ 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. + and can change outside of control plane operations. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_04_01.models.CapacityReservationInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response @@ -646,19 +671,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -672,7 +704,7 @@ def get( 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 @@ -696,6 +728,8 @@ def list_by_capacity_reservation_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.CapacityReservationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -708,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -719,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -736,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]: @@ -749,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_host_groups_operations.py index 793310a1184e..b89d72b929bc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -188,30 +190,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -220,29 +223,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -297,6 +301,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -305,6 +310,7 @@ def create_or_update( 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'], @@ -312,7 +318,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -330,7 +340,7 @@ def create_or_update( 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 @@ -360,6 +370,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -368,6 +379,7 @@ def update( 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'], @@ -375,7 +387,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -389,11 +405,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -416,17 +432,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -436,7 +459,7 @@ 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 @@ -455,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_04_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) @@ -468,18 +491,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -493,7 +523,7 @@ def get( 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 @@ -514,6 +544,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -525,6 +557,7 @@ def prepare_request(next_link=None): 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) @@ -535,6 +568,7 @@ def prepare_request(next_link=None): 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) @@ -552,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]: @@ -565,7 +603,7 @@ def get_next(next_link=None): 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( @@ -582,6 +620,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -592,6 +632,7 @@ def prepare_request(next_link=None): 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) @@ -601,6 +642,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -618,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]: @@ -631,4 +677,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_hosts_operations.py index e1fa37b4bf41..73fda3d31489 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_by_host_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -332,8 +341,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -346,6 +356,7 @@ 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 @@ -370,10 +381,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore def _update_initial( self, @@ -389,6 +399,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -398,6 +409,7 @@ def _update_initial( 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'], @@ -405,7 +417,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,7 +435,7 @@ def _update_initial( 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 @@ -454,8 +470,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,6 +485,7 @@ 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 @@ -492,12 +510,11 @@ 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) + 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 + 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: str, host_group_name: str, @@ -510,18 +527,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -531,11 +555,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -562,7 +586,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -574,6 +599,7 @@ 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 ) @@ -594,10 +620,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace def get( @@ -618,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_04_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) @@ -631,19 +656,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -657,7 +689,7 @@ def get( 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 @@ -681,6 +713,8 @@ def list_by_host_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -693,6 +727,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +739,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +774,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_accesses_operations.py index e79d3a57ce68..0cbad2658ec4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_get_private_link_resources_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -296,12 +301,12 @@ def build_update_a_private_endpoint_connection_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -309,23 +314,23 @@ def build_update_a_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -339,10 +344,11 @@ def build_get_a_private_endpoint_connection_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -350,21 +356,21 @@ def build_get_a_private_endpoint_connection_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -376,10 +382,11 @@ def build_delete_a_private_endpoint_connection_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -387,21 +394,21 @@ def build_delete_a_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -412,31 +419,32 @@ def build_list_private_endpoint_connections_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -475,6 +483,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -483,6 +492,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -490,7 +500,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -508,7 +522,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -541,8 +555,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -554,6 +569,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -578,10 +594,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore def _update_initial( self, @@ -596,6 +611,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -604,6 +620,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -611,7 +628,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -629,7 +650,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -662,8 +683,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -675,6 +697,7 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -699,10 +722,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def get( @@ -730,17 +752,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -754,10 +783,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -769,17 +798,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -789,11 +825,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -819,7 +855,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -830,6 +867,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -850,10 +888,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -870,6 +907,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -881,6 +920,7 @@ def prepare_request(next_link=None): 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) @@ -891,6 +931,7 @@ def prepare_request(next_link=None): 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) @@ -908,7 +949,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]: @@ -921,7 +966,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -935,6 +980,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -945,6 +992,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -954,6 +1002,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -971,7 +1020,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]: @@ -984,7 +1037,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def get_private_link_resources( @@ -1012,17 +1065,24 @@ def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1036,7 +1096,7 @@ def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore def _update_a_private_endpoint_connection_initial( @@ -1053,6 +1113,7 @@ def _update_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -1062,6 +1123,7 @@ def _update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], @@ -1069,7 +1131,11 @@ def _update_a_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1087,7 +1153,7 @@ def _update_a_private_endpoint_connection_initial( return deserialized - _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace @@ -1128,8 +1194,9 @@ def begin_update_a_private_endpoint_connection( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -1142,6 +1209,7 @@ def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1166,10 +1234,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_update_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def get_a_private_endpoint_connection( @@ -1200,18 +1267,25 @@ def get_a_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_a_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_a_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1225,10 +1299,10 @@ def get_a_private_endpoint_connection( return deserialized - get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - def _delete_a_private_endpoint_connection_initial( + def _delete_a_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -1241,18 +1315,25 @@ def _delete_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_a_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1262,11 +1343,11 @@ def _delete_a_private_endpoint_connection_initial( if cls: return cls(pipeline_response, None, {}) - _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete_a_private_endpoint_connection( + def begin_delete_a_private_endpoint_connection( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -1295,7 +1376,8 @@ def begin_delete_a_private_endpoint_connection( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,6 +1389,7 @@ def begin_delete_a_private_endpoint_connection( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1327,10 +1410,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_private_endpoint_connections( @@ -1354,6 +1436,8 @@ def list_private_endpoint_connections( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1366,6 +1450,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) @@ -1377,6 +1462,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1394,7 +1480,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]: @@ -1407,4 +1497,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_encryption_sets_operations.py index 6faf65807c01..f57b0a90195d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_list_associated_resources_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -320,6 +325,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -328,6 +334,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -335,7 +342,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -353,7 +364,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -388,8 +399,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -401,6 +413,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -425,10 +438,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore def _update_initial( self, @@ -443,6 +455,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -451,6 +464,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -458,7 +472,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -476,7 +494,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -511,8 +529,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -524,6 +543,7 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -548,10 +568,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def get( @@ -579,17 +598,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -603,10 +629,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -618,17 +644,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -638,11 +671,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -668,7 +701,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -679,6 +713,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -699,10 +734,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -721,6 +755,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -732,6 +768,7 @@ def prepare_request(next_link=None): 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) @@ -742,6 +779,7 @@ def prepare_request(next_link=None): 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) @@ -759,7 +797,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]: @@ -772,7 +814,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -788,6 +830,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -798,6 +842,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -807,6 +852,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -824,7 +870,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]: @@ -837,7 +887,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -859,6 +909,8 @@ def list_associated_resources( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -871,6 +923,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -882,6 +935,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -899,7 +953,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]: @@ -912,4 +970,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_restore_point_operations.py index 6da394763c1b..d57dc202d091 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disk_restore_point_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( disk_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}") # 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'), @@ -49,21 +50,21 @@ def build_get_request( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -75,10 +76,11 @@ def build_list_by_restore_point_request( vm_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints") # 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'), @@ -86,21 +88,21 @@ def build_list_by_restore_point_request( "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -116,12 +118,12 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess") # 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'), @@ -130,23 +132,23 @@ def build_grant_access_request_initial( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -161,10 +163,11 @@ def build_revoke_access_request_initial( disk_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess") # 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'), @@ -173,21 +176,21 @@ def build_revoke_access_request_initial( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -245,6 +248,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -252,12 +257,17 @@ def get( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_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) - 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]: @@ -271,7 +281,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}"} # type: ignore @distributed_trace @@ -299,6 +309,8 @@ def list_by_restore_point( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -312,6 +324,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=self.list_by_restore_point.metadata['url'], ) request = _convert_request(request) @@ -324,6 +337,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -341,7 +355,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]: @@ -354,7 +372,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + list_by_restore_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints"} # type: ignore def _grant_access_initial( self, @@ -371,6 +389,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -381,6 +400,7 @@ def _grant_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -388,7 +408,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -404,7 +428,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore @distributed_trace @@ -444,8 +468,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -459,6 +484,7 @@ def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -483,12 +509,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -502,6 +527,8 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, @@ -509,12 +536,17 @@ def _revoke_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -524,11 +556,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -560,7 +592,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -573,6 +606,7 @@ def begin_revoke_access( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -593,7 +627,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disks_operations.py index 6e617b049830..910b14a8e7d7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_images_operations.py index 8caa617e9862..5d4885584d7d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -154,33 +155,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -291,6 +296,7 @@ def _create_or_update_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'], @@ -298,7 +304,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -316,7 +326,7 @@ def _create_or_update_initial( 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 @@ -347,8 +357,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -360,6 +371,7 @@ 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 @@ -384,10 +396,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -402,6 +413,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -410,6 +422,7 @@ def _update_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'], @@ -417,7 +430,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -435,7 +452,7 @@ def _update_initial( 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 @@ -466,8 +483,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +497,7 @@ 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 @@ -503,12 +522,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -520,17 +538,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -540,11 +565,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -568,7 +593,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -579,6 +605,7 @@ 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 ) @@ -599,10 +626,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -618,7 +644,7 @@ 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) @@ -631,18 +657,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -656,7 +689,7 @@ def get( 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 @@ -674,6 +707,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -685,6 +720,7 @@ def prepare_request(next_link=None): 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) @@ -695,6 +731,7 @@ def prepare_request(next_link=None): 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) @@ -712,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]: @@ -725,7 +766,7 @@ def get_next(next_link=None): 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( @@ -740,6 +781,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -750,6 +793,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -759,6 +803,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -776,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]: @@ -789,4 +838,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_log_analytics_operations.py index 463a853de833..7b7db65a6974 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_operations.py index 688f299d04b5..f0a49c926ccc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_proximity_placement_groups_operations.py index 924324eaa818..065139c2d344 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( include_colocation_status: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -187,29 +189,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -295,6 +299,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -303,6 +308,7 @@ def create_or_update( 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'], @@ -310,7 +316,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -328,7 +338,7 @@ def create_or_update( 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 @@ -358,6 +368,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -366,6 +377,7 @@ def update( 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'], @@ -373,7 +385,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -387,11 +403,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -414,17 +430,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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,7 +457,7 @@ 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 @@ -452,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) @@ -465,18 +488,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -490,7 +520,7 @@ def get( 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 @@ -507,6 +537,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -517,6 +549,7 @@ def prepare_request(next_link=None): 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) @@ -526,6 +559,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -543,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]: @@ -556,7 +594,7 @@ def get_next(next_link=None): 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( @@ -575,6 +613,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -586,6 +626,7 @@ def prepare_request(next_link=None): 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) @@ -596,6 +637,7 @@ def prepare_request(next_link=None): 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) @@ -613,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]: @@ -626,4 +672,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_point_collections_operations.py index 418ff6ad41fb..207222700d22 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_point_collections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( restore_point_collection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -160,33 +161,34 @@ def build_get_request( expand: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,30 +198,31 @@ def build_list_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -228,29 +231,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -306,6 +310,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollection') @@ -314,6 +319,7 @@ def create_or_update( 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'], @@ -321,7 +327,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -339,7 +349,7 @@ def create_or_update( 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 @@ -369,6 +379,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') @@ -377,6 +388,7 @@ def update( 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'], @@ -384,7 +396,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -398,10 +414,10 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -413,17 +429,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -433,11 +456,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -462,7 +485,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -473,6 +497,7 @@ 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 ) @@ -493,10 +518,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore @distributed_trace def get( @@ -513,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_04_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) @@ -526,18 +550,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -551,7 +582,7 @@ def get( 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 @@ -571,6 +602,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -582,6 +615,7 @@ def prepare_request(next_link=None): 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) @@ -592,6 +626,7 @@ def prepare_request(next_link=None): 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) @@ -609,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]: @@ -622,7 +661,7 @@ def get_next(next_link=None): 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( @@ -640,6 +679,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -650,6 +691,7 @@ def prepare_request(next_link=None): 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) @@ -659,6 +701,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -676,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]: @@ -689,4 +736,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_points_operations.py index 926a575d4646..72ab3c70f913 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_restore_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + _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'), @@ -51,23 +51,23 @@ def build_create_request_initial( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -81,10 +81,11 @@ def build_delete_request_initial( restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + _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'), @@ -92,21 +93,21 @@ def build_delete_request_initial( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -118,10 +119,11 @@ def build_get_request( restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + _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'), @@ -129,21 +131,21 @@ def build_get_request( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,6 +185,7 @@ def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePoint') @@ -192,6 +195,7 @@ def _create_initial( 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'], @@ -199,7 +203,11 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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 [201]: @@ -213,7 +221,7 @@ def _create_initial( 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 @@ -249,8 +257,9 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.RestorePoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +272,7 @@ 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 @@ -287,12 +297,11 @@ 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) + 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 + 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: str, restore_point_collection_name: str, @@ -305,18 +314,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -326,11 +342,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -357,7 +373,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -369,6 +386,7 @@ 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 ) @@ -389,10 +407,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore @distributed_trace def get( @@ -421,18 +438,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -446,5 +470,5 @@ def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_snapshots_operations.py index 6e60ec476564..ae0c5a8ef44a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_ssh_public_keys_operations.py index 9c5b5dc5c5e3..58b5bdd2e9f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,30 +64,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -100,35 +102,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -144,35 +146,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -185,25 +187,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -214,31 +217,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -249,31 +253,32 @@ def build_generate_key_pair_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -314,6 +319,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -324,6 +331,7 @@ def prepare_request(next_link=None): 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) @@ -333,6 +341,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -350,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]: @@ -363,7 +376,7 @@ def get_next(next_link=None): 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( @@ -383,6 +396,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -394,6 +409,7 @@ def prepare_request(next_link=None): 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) @@ -404,6 +420,7 @@ def prepare_request(next_link=None): 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) @@ -421,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]: @@ -434,7 +455,7 @@ def get_next(next_link=None): 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( @@ -463,6 +484,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -471,6 +493,7 @@ def create( 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'], @@ -478,7 +501,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def create( 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 @@ -526,6 +553,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -534,6 +562,7 @@ def update( 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'], @@ -541,7 +570,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -555,11 +588,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -582,17 +615,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -602,7 +642,7 @@ 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 @@ -629,17 +669,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -653,7 +700,7 @@ def get( 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 @@ -682,17 +729,24 @@ def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -706,5 +760,5 @@ def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_usage_operations.py index 6543f9ccded8..d59e2e77a7d4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extension_images_operations.py index 1a76f8679881..f7c3a375268c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extensions_operations.py index 6ae3d3450ad1..5e4fb61d4dfb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,9 +127,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -137,16 +138,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -160,10 +161,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -171,23 +173,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -200,33 +202,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,6 +269,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -275,6 +279,7 @@ def _create_or_update_initial( 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'], @@ -282,7 +287,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -300,7 +309,7 @@ def _create_or_update_initial( 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 @@ -338,8 +347,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,6 +362,7 @@ 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 @@ -376,10 +387,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -395,6 +405,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -404,6 +415,7 @@ def _update_initial( 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'], @@ -411,7 +423,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -425,7 +441,7 @@ def _update_initial( 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 @@ -463,8 +479,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,6 +494,7 @@ 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 @@ -501,12 +519,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -519,18 +536,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -540,11 +564,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -571,7 +595,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -583,6 +608,7 @@ 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 ) @@ -603,10 +629,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -625,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) @@ -638,19 +663,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -664,7 +696,7 @@ def get( 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 @@ -681,7 +713,7 @@ 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) @@ -694,18 +726,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -719,5 +758,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_edge_zone_operations.py index 58a58bc51b41..b986c5fc9c7d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_edge_zone_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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}') + _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'), @@ -49,21 +50,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -81,10 +82,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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'), @@ -94,27 +96,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -126,10 +128,11 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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'), @@ -137,21 +140,21 @@ def build_list_offers_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,31 +165,32 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,10 +203,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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'), @@ -211,21 +216,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -287,6 +292,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( location=location, @@ -296,12 +303,17 @@ def get( 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(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]: @@ -315,7 +327,7 @@ def get( 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 @@ -344,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) @@ -362,6 +375,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_list_request( location=location, @@ -370,6 +385,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -378,7 +394,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -392,7 +412,7 @@ def list( 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 @@ -423,18 +443,25 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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]: @@ -448,7 +475,7 @@ def list_offers( 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 @@ -475,17 +502,24 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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 +533,7 @@ def list_publishers( 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 @@ -533,6 +567,8 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_list_skus_request( location=location, @@ -540,12 +576,17 @@ def list_skus( 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(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]: @@ -559,5 +600,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_operations.py index b9df3f165b1d..a7a4620d1d09 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_run_commands_operations.py index e942fcbc67ae..60e68d70396c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,31 +69,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -107,12 +109,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -120,23 +122,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -153,12 +155,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -166,23 +168,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -196,10 +198,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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}') + _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'), @@ -207,21 +210,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -235,10 +238,11 @@ def build_get_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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}') + _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'), @@ -246,23 +250,23 @@ def build_get_by_virtual_machine_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -275,33 +279,34 @@ def build_list_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -344,6 +349,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -355,6 +362,7 @@ def prepare_request(next_link=None): 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) @@ -365,6 +373,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -382,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]: @@ -395,7 +408,7 @@ def get_next(next_link=None): 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( @@ -421,17 +434,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -445,7 +465,7 @@ def get( 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( @@ -454,6 +474,8 @@ 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"] @@ -462,7 +484,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -471,6 +493,7 @@ def _create_or_update_initial( 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'], @@ -478,7 +501,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def _create_or_update_initial( 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 @@ -506,6 +533,8 @@ def begin_create_or_update( 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. @@ -519,6 +548,9 @@ 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_04_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 @@ -533,8 +565,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -548,6 +580,7 @@ def begin_create_or_update( 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 ) @@ -571,10 +604,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore def _update_initial( self, @@ -582,6 +614,8 @@ 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"] @@ -590,7 +624,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -599,6 +633,7 @@ def _update_initial( 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'], @@ -606,7 +641,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +659,7 @@ def _update_initial( 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 @@ -630,6 +669,8 @@ def begin_update( 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. @@ -642,6 +683,9 @@ 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_04_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 @@ -656,8 +700,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -671,6 +715,7 @@ def begin_update( 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 ) @@ -694,12 +739,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -712,18 +756,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -733,11 +784,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -764,7 +815,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -776,6 +828,7 @@ 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 ) @@ -796,10 +849,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get_by_virtual_machine( @@ -818,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) @@ -831,19 +883,26 @@ def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -857,7 +916,7 @@ def get_by_virtual_machine( 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 @@ -874,7 +933,7 @@ 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 @@ -883,6 +942,8 @@ def list_by_virtual_machine( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -895,6 +956,7 @@ def prepare_request(next_link=None): 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'], ) @@ -907,6 +969,7 @@ def prepare_request(next_link=None): 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, ) @@ -925,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]: @@ -938,4 +1005,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_extensions_operations.py index 45df238e6a8e..3b2daef3cfbc 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -336,8 +345,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -350,6 +360,7 @@ 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 @@ -374,10 +385,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore def _update_initial( self, @@ -393,6 +403,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -402,6 +413,7 @@ def _update_initial( 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'], @@ -409,7 +421,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,12 +521,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -521,18 +538,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -542,11 +566,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -573,7 +597,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -585,6 +610,7 @@ 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 ) @@ -605,10 +631,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -627,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) @@ -640,19 +665,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -666,7 +698,7 @@ def get( 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 @@ -689,6 +721,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -701,6 +735,7 @@ def prepare_request(next_link=None): 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) @@ -712,6 +747,7 @@ def prepare_request(next_link=None): 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) @@ -729,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]: @@ -742,4 +782,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 9acd93a4d80d..37fd7cfef5e7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,25 +33,26 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -62,25 +63,26 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -91,25 +93,26 @@ def build_start_extension_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -120,31 +123,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -170,7 +174,7 @@ 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: str, vm_scale_set_name: str, @@ -182,17 +186,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -202,11 +213,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -230,7 +241,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -241,6 +253,7 @@ 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 ) @@ -261,12 +274,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -278,17 +290,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,11 +317,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -328,7 +347,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -339,6 +359,7 @@ 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 ) @@ -359,12 +380,11 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def _start_extension_upgrade_initial( + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -376,17 +396,24 @@ def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -396,11 +423,11 @@ 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 @distributed_trace - def begin_start_extension_upgrade( + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -426,7 +453,8 @@ def begin_start_extension_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -437,6 +465,7 @@ 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 ) @@ -457,10 +486,9 @@ 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) + 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 + begin_start_extension_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -486,17 +514,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -510,5 +545,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 007f191157d4..e66808c98c25 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -53,23 +53,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -87,12 +87,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -101,23 +101,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -132,10 +132,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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}') + _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'), @@ -144,21 +145,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -173,10 +174,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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}') + _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'), @@ -185,23 +187,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,10 +217,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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'), @@ -226,23 +229,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +286,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') @@ -293,6 +297,7 @@ def _create_or_update_initial( 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'], @@ -300,7 +305,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -359,8 +368,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -374,6 +384,7 @@ 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 @@ -398,10 +409,9 @@ 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) + 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 + 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, @@ -418,6 +428,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') @@ -428,6 +439,7 @@ def _update_initial( 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'], @@ -435,7 +447,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -449,7 +465,7 @@ def _update_initial( 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 @@ -490,8 +506,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -505,6 +522,7 @@ 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 @@ -529,12 +547,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -548,6 +565,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -555,12 +574,17 @@ def _delete_initial( 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) - 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]: @@ -570,11 +594,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -604,7 +628,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -617,6 +642,7 @@ 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 ) @@ -637,10 +663,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -662,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) @@ -675,6 +700,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -682,13 +709,18 @@ def get( 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) - 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]: @@ -702,7 +734,7 @@ def get( 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 @@ -722,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) @@ -735,19 +767,26 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -761,5 +800,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 742adc8597d0..b7657fa663b9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -133,10 +133,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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}') + _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'), @@ -145,21 +146,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -174,10 +175,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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}') + _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'), @@ -186,23 +188,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -216,10 +218,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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'), @@ -227,23 +230,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -276,6 +279,8 @@ 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"] @@ -284,7 +289,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -294,6 +299,7 @@ def _create_or_update_initial( 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'], @@ -301,7 +307,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -319,7 +329,7 @@ def _create_or_update_initial( 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 @@ -330,6 +340,8 @@ def begin_create_or_update( 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. @@ -344,6 +356,9 @@ 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_04_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 @@ -358,8 +373,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -374,6 +389,7 @@ def begin_create_or_update( 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 ) @@ -397,10 +413,9 @@ 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) + 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 + 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, @@ -409,6 +424,8 @@ 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"] @@ -417,7 +434,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -427,6 +444,7 @@ def _update_initial( 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'], @@ -434,7 +452,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -448,7 +470,7 @@ def _update_initial( 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 @@ -459,6 +481,8 @@ def begin_update( 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. @@ -473,6 +497,9 @@ 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_04_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 @@ -487,8 +514,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -503,6 +530,7 @@ def begin_update( 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 ) @@ -526,12 +554,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -545,6 +572,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -552,12 +581,17 @@ def _delete_initial( 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) - 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]: @@ -567,11 +601,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -601,7 +635,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -614,6 +649,7 @@ 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 ) @@ -634,10 +670,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get( @@ -659,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) @@ -672,6 +707,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -679,13 +716,18 @@ def get( 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) - 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]: @@ -699,7 +741,7 @@ def get( 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 @@ -719,7 +761,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -728,6 +770,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -741,6 +785,7 @@ def prepare_request(next_link=None): 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'], ) @@ -754,6 +799,7 @@ def prepare_request(next_link=None): 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, ) @@ -772,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]: @@ -785,4 +835,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vms_operations.py index 1b84eeb4cdc6..69ab6062ff2e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,11 +39,11 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -51,22 +51,22 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,9 +80,10 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall') + _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'), @@ -90,16 +91,16 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -111,9 +112,10 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate') + _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'), @@ -121,16 +123,16 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -145,12 +147,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -158,23 +160,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -190,9 +192,10 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -200,18 +203,18 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -225,10 +228,11 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -236,23 +240,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -264,10 +268,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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'), @@ -275,21 +280,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -304,37 +309,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -348,9 +354,10 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -358,18 +365,18 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -381,9 +388,10 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -391,16 +399,16 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -412,9 +420,10 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -422,16 +431,16 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -443,9 +452,10 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -453,16 +463,16 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -476,10 +486,11 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-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') + _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'), @@ -487,23 +498,23 @@ def build_retrieve_boot_diagnostics_data_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -515,9 +526,10 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -525,16 +537,16 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -546,9 +558,10 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + _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'), @@ -556,16 +569,16 @@ def build_simulate_eviction_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -580,12 +593,12 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -593,29 +606,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -637,7 +650,7 @@ 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: str, vm_scale_set_name: str, @@ -651,6 +664,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -663,6 +677,7 @@ def _reimage_initial( 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'], @@ -670,7 +685,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -680,11 +699,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -701,6 +720,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -715,8 +735,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -729,6 +750,7 @@ 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 @@ -750,12 +772,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -768,18 +789,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -789,11 +817,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -821,7 +849,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -833,6 +862,7 @@ 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 ) @@ -853,12 +883,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -871,18 +900,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -892,11 +928,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -925,7 +961,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -937,6 +974,7 @@ 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 ) @@ -957,10 +995,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -976,6 +1013,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -985,6 +1023,7 @@ def _update_initial( 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'], @@ -992,7 +1031,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1010,7 +1053,7 @@ def _update_initial( 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 @@ -1047,8 +1090,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -1061,6 +1105,7 @@ 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 @@ -1085,12 +1130,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1104,19 +1148,26 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -1126,11 +1177,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1147,7 +1198,7 @@ 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. @@ -1161,7 +1212,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1174,6 +1226,7 @@ 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 ) @@ -1194,10 +1247,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1218,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_04_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) @@ -1231,19 +1283,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -1257,7 +1316,7 @@ def get( 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 @@ -1287,18 +1346,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -1312,7 +1378,7 @@ def get_instance_view( 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 @@ -1333,12 +1399,13 @@ 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 @@ -1347,6 +1414,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1359,6 +1428,7 @@ def prepare_request(next_link=None): 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, @@ -1373,6 +1443,7 @@ def prepare_request(next_link=None): 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, @@ -1393,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]: @@ -1406,9 +1481,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1422,19 +1497,26 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -1444,11 +1526,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1468,7 +1550,7 @@ 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. @@ -1482,7 +1564,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1495,6 +1578,7 @@ 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 ) @@ -1515,12 +1599,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1533,18 +1616,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1554,11 +1644,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1585,7 +1675,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1597,6 +1688,7 @@ 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 ) @@ -1617,12 +1709,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1635,18 +1726,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1656,11 +1754,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1687,7 +1785,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1699,6 +1798,7 @@ 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 ) @@ -1719,12 +1819,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1737,18 +1836,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1758,11 +1864,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1790,7 +1896,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1802,6 +1909,7 @@ 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 ) @@ -1822,10 +1930,9 @@ 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) + 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 + 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( @@ -1847,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) @@ -1860,19 +1967,26 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-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) - 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]: @@ -1886,10 +2000,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1902,18 +2016,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1923,11 +2044,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1954,7 +2075,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1966,6 +2088,7 @@ 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 ) @@ -1986,13 +2109,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2018,18 +2140,25 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -2039,7 +2168,7 @@ 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( @@ -2048,6 +2177,8 @@ 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"]] @@ -2056,7 +2187,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2065,6 +2196,7 @@ def _run_command_initial( 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'], @@ -2072,7 +2204,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2088,7 +2224,7 @@ def _run_command_initial( 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 @@ -2098,6 +2234,8 @@ def begin_run_command( 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. @@ -2110,6 +2248,9 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_04_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 @@ -2123,8 +2264,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -2138,6 +2279,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2161,7 +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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_sets_operations.py index 665ec72a2995..df2ff018b161 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -158,27 +159,28 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -191,33 +193,34 @@ def build_get_request( expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -231,33 +234,33 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -274,35 +277,35 @@ def build_delete_instances_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -315,31 +318,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -349,30 +353,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -381,29 +386,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -414,31 +420,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -449,31 +456,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -488,35 +496,35 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -532,33 +540,33 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -574,33 +582,33 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -616,33 +624,33 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -658,33 +666,33 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -700,33 +708,33 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -742,33 +750,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -784,33 +792,33 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -825,32 +833,33 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -864,33 +873,33 @@ def build_convert_to_single_placement_group_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -906,39 +915,39 @@ def build_set_orchestration_service_state_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -977,6 +986,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -988,6 +999,7 @@ def prepare_request(next_link=None): 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) @@ -998,6 +1010,7 @@ def prepare_request(next_link=None): 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) @@ -1015,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]: @@ -1028,7 +1045,7 @@ def get_next(next_link=None): 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, @@ -1043,6 +1060,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -1051,6 +1069,7 @@ def _create_or_update_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'], @@ -1058,7 +1077,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1076,7 +1099,7 @@ def _create_or_update_initial( 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 @@ -1109,8 +1132,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1122,6 +1146,7 @@ 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 @@ -1146,10 +1171,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -1164,6 +1188,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -1172,6 +1197,7 @@ def _update_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'], @@ -1179,7 +1205,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1193,7 +1223,7 @@ def _update_initial( 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 @@ -1226,8 +1256,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1239,6 +1270,7 @@ 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 @@ -1263,12 +1295,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1281,18 +1312,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1302,11 +1340,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1320,6 +1358,7 @@ 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. @@ -1333,7 +1372,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1345,6 +1385,7 @@ 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 ) @@ -1365,10 +1406,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1386,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_04_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) @@ -1399,18 +1439,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -1424,10 +1471,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1440,6 +1487,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1451,6 +1499,7 @@ def _deallocate_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'], @@ -1458,7 +1507,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1468,11 +1521,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1487,7 +1540,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1502,8 +1556,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1515,6 +1570,7 @@ 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 @@ -1536,12 +1592,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1555,6 +1610,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1563,6 +1619,7 @@ def _delete_instances_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, @@ -1571,7 +1628,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1581,11 +1642,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1603,7 +1664,7 @@ def begin_delete_instances( :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs :param force_deletion: Optional parameter to force delete virtual machines from the VM scale - set. (Feature in Preview). + 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. @@ -1617,8 +1678,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1631,6 +1693,7 @@ 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 @@ -1652,10 +1715,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1681,17 +1743,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -1705,7 +1774,7 @@ def get_instance_view( 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 @@ -1725,6 +1794,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1736,6 +1807,7 @@ def prepare_request(next_link=None): 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) @@ -1746,6 +1818,7 @@ def prepare_request(next_link=None): 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) @@ -1763,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]: @@ -1776,7 +1853,7 @@ def get_next(next_link=None): 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( @@ -1794,6 +1871,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1804,6 +1883,7 @@ def prepare_request(next_link=None): 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) @@ -1813,6 +1893,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1830,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]: @@ -1843,7 +1928,7 @@ def get_next(next_link=None): 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( @@ -1866,6 +1951,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1878,6 +1965,7 @@ def prepare_request(next_link=None): 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) @@ -1889,6 +1977,7 @@ def prepare_request(next_link=None): 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) @@ -1906,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]: @@ -1919,7 +2012,7 @@ def get_next(next_link=None): 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( @@ -1941,6 +2034,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1953,6 +2048,7 @@ def prepare_request(next_link=None): 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) @@ -1964,6 +2060,7 @@ def prepare_request(next_link=None): 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) @@ -1981,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]: @@ -1994,9 +2095,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -2010,6 +2111,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2021,6 +2123,7 @@ def _power_off_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, @@ -2029,7 +2132,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2039,11 +2146,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2061,9 +2168,10 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2078,8 +2186,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2092,6 +2201,7 @@ 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 @@ -2113,12 +2223,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2131,6 +2240,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2142,6 +2252,7 @@ def _restart_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'], @@ -2149,7 +2260,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2159,11 +2274,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2176,7 +2291,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2191,8 +2307,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2204,6 +2321,7 @@ 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 @@ -2225,12 +2343,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2243,6 +2360,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2254,6 +2372,7 @@ def _start_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'], @@ -2261,7 +2380,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2271,11 +2394,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2288,7 +2411,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2303,8 +2427,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2316,6 +2441,7 @@ 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 @@ -2337,12 +2463,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2355,6 +2480,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2366,6 +2492,7 @@ def _redeploy_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'], @@ -2373,7 +2500,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2383,11 +2514,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2401,7 +2532,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2416,8 +2548,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2429,6 +2562,7 @@ 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 @@ -2450,12 +2584,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2468,6 +2601,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2479,6 +2613,7 @@ def _perform_maintenance_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'], @@ -2486,7 +2621,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2496,11 +2635,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2516,7 +2655,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2531,8 +2671,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2544,6 +2685,7 @@ 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 @@ -2565,12 +2707,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2583,6 +2724,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2591,6 +2733,7 @@ def _update_instances_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'], @@ -2598,7 +2741,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2608,11 +2755,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2640,8 +2787,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2653,6 +2801,7 @@ 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 @@ -2674,12 +2823,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2692,6 +2840,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -2703,6 +2852,7 @@ def _reimage_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'], @@ -2710,7 +2860,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2720,11 +2874,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2739,7 +2893,7 @@ 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. + :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_04_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -2754,8 +2908,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2767,6 +2922,7 @@ 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 @@ -2788,12 +2944,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2806,6 +2961,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2817,6 +2973,7 @@ def _reimage_all_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'], @@ -2824,7 +2981,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2834,11 +2995,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2852,7 +3013,8 @@ 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. + :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_04_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2867,8 +3029,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2880,6 +3043,7 @@ 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 @@ -2901,10 +3065,9 @@ 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) + 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 + 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( @@ -2935,18 +3098,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -2960,11 +3130,11 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2991,6 +3161,7 @@ def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2999,6 +3170,7 @@ def convert_to_single_placement_group( 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'], @@ -3006,7 +3178,11 @@ def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3016,10 +3192,10 @@ 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: str, vm_scale_set_name: str, @@ -3032,6 +3208,7 @@ def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -3040,6 +3217,7 @@ def _set_orchestration_service_state_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'], @@ -3047,7 +3225,11 @@ def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3057,11 +3239,11 @@ 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 @distributed_trace - def begin_set_orchestration_service_state( + def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -3088,8 +3270,9 @@ def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -3101,6 +3284,7 @@ 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 @@ -3122,7 +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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_sizes_operations.py index 76c4f2ba95a0..4db22fb3ae12 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,6 +99,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -109,6 +112,7 @@ def prepare_request(next_link=None): 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) @@ -119,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machines_operations.py index 92d456791756..bffe942c53e9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_04_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -202,27 +203,28 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -235,33 +237,34 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -272,31 +275,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -307,25 +311,26 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -336,25 +341,26 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -365,25 +371,26 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -393,30 +400,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -427,31 +435,32 @@ def build_list_all_request( status_only: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -462,31 +471,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -499,27 +509,28 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -530,31 +541,32 @@ def build_reapply_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -565,25 +577,26 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -594,25 +607,26 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -623,25 +637,26 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -655,33 +670,33 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -696,33 +711,34 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -733,25 +749,26 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -762,25 +779,26 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -791,31 +809,32 @@ def build_assess_patches_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-04-01" + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -829,35 +848,35 @@ def build_install_patches_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -873,41 +892,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-04-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -946,6 +965,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -957,6 +978,7 @@ def prepare_request(next_link=None): 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) @@ -967,6 +989,7 @@ def prepare_request(next_link=None): 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) @@ -984,7 +1007,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]: @@ -997,7 +1024,7 @@ def get_next(next_link=None): 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, @@ -1012,6 +1039,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -1020,6 +1048,7 @@ def _capture_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'], @@ -1027,7 +1056,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1043,7 +1076,7 @@ def _capture_initial( 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 @@ -1077,8 +1110,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1090,6 +1124,7 @@ 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 @@ -1114,10 +1149,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -1132,6 +1166,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -1140,6 +1175,7 @@ def _create_or_update_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'], @@ -1147,7 +1183,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1165,7 +1205,7 @@ def _create_or_update_initial( 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 @@ -1198,8 +1238,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1211,6 +1252,7 @@ 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 @@ -1235,10 +1277,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1253,6 +1294,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1261,6 +1303,7 @@ def _update_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'], @@ -1268,7 +1311,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1282,7 +1329,7 @@ def _update_initial( 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 @@ -1314,8 +1361,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1327,6 +1375,7 @@ 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 @@ -1351,12 +1400,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1369,18 +1417,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -1390,11 +1445,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1407,7 +1462,8 @@ 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. @@ -1421,7 +1477,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1433,6 +1490,7 @@ 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 ) @@ -1453,10 +1511,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1476,6 +1533,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_04_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) @@ -1488,18 +1546,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -1513,7 +1578,7 @@ def get( 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 @@ -1540,17 +1605,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -1564,10 +1636,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1579,17 +1651,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1599,11 +1678,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1628,7 +1707,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1639,6 +1719,7 @@ 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 ) @@ -1659,12 +1740,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1676,17 +1756,24 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1696,11 +1783,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1725,7 +1812,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1736,6 +1824,7 @@ def begin_deallocate( raw_result = self._deallocate_initial( resource_group_name=resource_group_name, vm_name=vm_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1756,13 +1845,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1790,17 +1878,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -1810,7 +1905,7 @@ 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 @@ -1831,6 +1926,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1842,6 +1939,7 @@ def prepare_request(next_link=None): 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) @@ -1852,6 +1950,7 @@ def prepare_request(next_link=None): 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) @@ -1869,7 +1968,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]: @@ -1882,7 +1985,7 @@ def get_next(next_link=None): 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( @@ -1894,7 +1997,7 @@ 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 @@ -1903,6 +2006,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1913,6 +2018,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1923,6 +2029,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1941,7 +2048,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]: @@ -1954,7 +2065,7 @@ def get_next(next_link=None): 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( @@ -1977,6 +2088,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1989,6 +2102,7 @@ def prepare_request(next_link=None): 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) @@ -2000,6 +2114,7 @@ def prepare_request(next_link=None): 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) @@ -2017,7 +2132,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]: @@ -2030,9 +2149,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -2045,18 +2164,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -2066,11 +2192,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2086,7 +2212,7 @@ 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. @@ -2100,7 +2226,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2112,6 +2239,7 @@ 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 ) @@ -2132,12 +2260,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2149,17 +2276,24 @@ def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -2169,11 +2303,11 @@ 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 @distributed_trace - def begin_reapply( + def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2197,7 +2331,8 @@ def begin_reapply( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2208,6 +2343,7 @@ 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 ) @@ -2228,12 +2364,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2245,17 +2380,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -2265,11 +2407,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2293,7 +2435,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2304,6 +2447,7 @@ 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 ) @@ -2324,12 +2468,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2341,17 +2484,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -2361,11 +2511,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2389,7 +2539,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2400,6 +2551,7 @@ 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 ) @@ -2420,12 +2572,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2437,17 +2588,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -2457,11 +2615,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2485,7 +2643,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2496,6 +2655,7 @@ 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 ) @@ -2516,12 +2676,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2534,6 +2693,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -2545,6 +2705,7 @@ def _reimage_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'], @@ -2552,7 +2713,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2562,11 +2727,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2579,7 +2744,8 @@ 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_04_01.models.VirtualMachineReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2593,8 +2759,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2606,6 +2773,7 @@ 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 @@ -2627,10 +2795,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore @distributed_trace def retrieve_boot_diagnostics_data( @@ -2648,7 +2815,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) @@ -2661,18 +2828,25 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -2686,10 +2860,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2701,17 +2875,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -2721,11 +2902,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2749,7 +2930,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2760,6 +2942,7 @@ 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 ) @@ -2780,13 +2963,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2809,17 +2991,24 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str + 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) - 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]: @@ -2829,7 +3018,7 @@ 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( @@ -2844,17 +3033,24 @@ def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: 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) - 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]: @@ -2870,7 +3066,7 @@ def _assess_patches_initial( 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 @@ -2900,7 +3096,8 @@ def begin_assess_patches( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -2911,6 +3108,7 @@ 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 ) @@ -2934,10 +3132,9 @@ 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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore def _install_patches_initial( self, @@ -2952,6 +3149,7 @@ def _install_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') @@ -2960,6 +3158,7 @@ def _install_patches_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'], @@ -2967,7 +3166,11 @@ def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2983,7 +3186,7 @@ def _install_patches_initial( 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 @@ -3017,8 +3220,9 @@ def begin_install_patches( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.VirtualMachineInstallPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-04-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -3030,6 +3234,7 @@ 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 @@ -3054,16 +3259,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) + 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 + 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: 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"]] @@ -3072,7 +3278,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-04-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -3080,6 +3286,7 @@ def _run_command_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'], @@ -3087,7 +3294,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3103,7 +3314,7 @@ def _run_command_initial( 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 @@ -3112,6 +3323,8 @@ def begin_run_command( 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. @@ -3122,6 +3335,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_04_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 @@ -3135,8 +3351,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_04_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-04-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( 'polling_interval', @@ -3149,6 +3365,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -3172,7 +3389,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py index 91d892a82f1e..e79f9a5f3db6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -138,8 +139,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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. """ @@ -201,7 +205,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_configuration.py index 0ed0f8a690ff..d96d5cd1b7be 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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__( @@ -38,6 +42,8 @@ def __init__( **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: @@ -45,7 +51,7 @@ def __init__( 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json index a62f3b7b26e7..3eb139bf5ddf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py index 93414748e5c9..98e739578f26 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -141,8 +142,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_configuration.py index c6e581dc9a0a..1016cbd75c3d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/_configuration.py @@ -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__( @@ -38,6 +42,8 @@ def __init__( **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: @@ -45,7 +51,7 @@ def __init__( 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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_availability_sets_operations.py index e152577543ef..6baaaa4275be 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~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 @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~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 @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~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 @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservation_groups_operations.py index cdb7cfcf62f3..0ab6fc360a33 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservation_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -139,6 +144,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -147,6 +153,7 @@ async def update( 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'], @@ -154,7 +161,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -168,11 +179,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -198,17 +209,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -218,7 +236,7 @@ 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 @@ -238,7 +256,7 @@ 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. + 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 @@ -252,18 +270,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -277,7 +302,7 @@ async def get( 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 @@ -294,7 +319,7 @@ 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. + 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 @@ -304,6 +329,8 @@ def list_by_resource_group( ~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 @@ -315,6 +342,7 @@ def prepare_request(next_link=None): 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'], ) @@ -326,6 +354,7 @@ def prepare_request(next_link=None): 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, ) @@ -344,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]: @@ -357,7 +390,7 @@ async def get_next(next_link=None): 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( @@ -370,7 +403,7 @@ 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. + 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 @@ -380,6 +413,8 @@ def list_by_subscription( ~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 @@ -390,6 +425,7 @@ def prepare_request(next_link=None): 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'], ) @@ -400,6 +436,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -418,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]: @@ -431,4 +472,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservations_operations.py index 38cfd6b433e3..c0e073b1f375 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_capacity_reservations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -134,8 +139,9 @@ async def begin_create_or_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -148,6 +154,7 @@ 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 @@ -172,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore async def _update_initial( self, @@ -191,6 +197,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -200,6 +207,7 @@ async def _update_initial( 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'], @@ -207,7 +215,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -223,7 +235,7 @@ async def _update_initial( 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 @@ -259,8 +271,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,6 +286,7 @@ 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 @@ -297,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -315,18 +328,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -336,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -369,7 +389,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -381,6 +402,7 @@ 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 ) @@ -401,10 +423,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore @distributed_trace_async async def get( @@ -425,7 +446,7 @@ 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. + 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 @@ -439,19 +460,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -465,7 +493,7 @@ async def get( 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 @@ -489,6 +517,8 @@ def list_by_capacity_reservation_group( ~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 @@ -501,6 +531,7 @@ def prepare_request(next_link=None): 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) @@ -512,6 +543,7 @@ def prepare_request(next_link=None): 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) @@ -529,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]: @@ -542,4 +578,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py index 390843086dc0..a0fc195eb596 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -68,17 +67,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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(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]: @@ -92,5 +98,5 @@ async def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py index 3920762372d8..0da4c9a3d1c5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -84,12 +85,17 @@ async def get( 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) - 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,5 +109,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py index 1f18facd1572..4bdb5ae31859 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_community_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -71,18 +70,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + 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(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]: @@ -96,5 +102,5 @@ async def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_host_groups_operations.py index f2d483f50619..bb2a074bf29c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -138,6 +143,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -146,6 +152,7 @@ async def update( 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'], @@ -153,7 +160,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -167,11 +178,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -194,17 +205,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -214,7 +232,7 @@ 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 @@ -233,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) @@ -246,18 +264,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -271,7 +296,7 @@ async def get( 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 @@ -292,6 +317,8 @@ def list_by_resource_group( ~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 @@ -303,6 +330,7 @@ def prepare_request(next_link=None): 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) @@ -313,6 +341,7 @@ def prepare_request(next_link=None): 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) @@ -330,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]: @@ -343,7 +376,7 @@ async def get_next(next_link=None): 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( @@ -360,6 +393,8 @@ def list_by_subscription( ~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 @@ -370,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -379,6 +415,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -396,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]: @@ -409,4 +450,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_hosts_operations.py index afeb1578fa1b..d0f677a13a53 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -255,8 +267,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,6 +282,7 @@ 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 @@ -293,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -311,18 +324,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -332,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -363,7 +383,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -375,6 +396,7 @@ 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 ) @@ -395,10 +417,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -482,6 +510,8 @@ def list_by_host_group( ~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 @@ -494,6 +524,7 @@ def prepare_request(next_link=None): 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) @@ -505,6 +536,7 @@ def prepare_request(next_link=None): 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) @@ -522,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]: @@ -535,4 +571,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_galleries_operations.py index 3ec55ca6eb51..468987177272 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -97,7 +102,7 @@ async def _create_or_update_initial( 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 @@ -130,8 +135,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.Gallery] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ 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 @@ -167,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -193,6 +200,7 @@ async def _update_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'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -214,7 +226,7 @@ async def _update_initial( 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 @@ -247,8 +259,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.Gallery] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -260,6 +273,7 @@ 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 @@ -284,10 +298,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace_async async def get( @@ -303,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) @@ -316,18 +329,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + api_version=api_version, select=select, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -341,10 +361,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -356,17 +376,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -376,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -404,7 +431,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -415,6 +443,7 @@ 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 ) @@ -435,10 +464,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -456,6 +484,8 @@ def list_by_resource_group( ~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 @@ -467,6 +497,7 @@ def prepare_request(next_link=None): 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) @@ -477,6 +508,7 @@ def prepare_request(next_link=None): 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) @@ -494,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]: @@ -507,7 +543,7 @@ async def get_next(next_link=None): 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( @@ -522,6 +558,8 @@ def list( ~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 @@ -532,6 +570,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -541,6 +580,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -558,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]: @@ -571,4 +615,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_application_versions_operations.py index 24de30b0dd70..e9f2b4f5ffc1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -147,8 +152,9 @@ async def begin_create_or_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -162,6 +168,7 @@ 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 @@ -186,10 +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) + 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 + 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, @@ -206,6 +212,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -216,6 +223,7 @@ async def _update_initial( 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'], @@ -223,7 +231,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -237,7 +249,7 @@ async def _update_initial( 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 @@ -283,8 +295,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -298,6 +311,7 @@ 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 @@ -322,10 +336,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) + 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 + 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( @@ -350,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) @@ -363,6 +376,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -370,13 +385,18 @@ async def get( 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) - 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]: @@ -390,10 +410,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -407,6 +427,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -414,12 +436,17 @@ async def _delete_initial( 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) - 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]: @@ -429,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -466,7 +493,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -479,6 +507,7 @@ 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 ) @@ -499,10 +528,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) + 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 + 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( @@ -529,6 +557,8 @@ def list_by_gallery_application( ~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 @@ -542,6 +572,7 @@ def prepare_request(next_link=None): 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) @@ -554,6 +585,7 @@ def prepare_request(next_link=None): 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) @@ -571,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]: @@ -584,4 +620,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_applications_operations.py index 7a932bf8ef4b..cd19cfc3fcf1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -139,8 +144,9 @@ async def begin_create_or_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -153,6 +159,7 @@ 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 @@ -177,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore async def _update_initial( self, @@ -196,6 +202,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -205,6 +212,7 @@ async def _update_initial( 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'], @@ -212,7 +220,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -265,8 +277,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,6 +292,7 @@ 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 @@ -303,10 +317,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace_async async def get( @@ -337,18 +350,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + 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(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]: @@ -362,10 +382,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -378,18 +398,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -399,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -431,7 +458,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -443,6 +471,7 @@ 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 ) @@ -463,10 +492,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -489,6 +517,8 @@ def list_by_gallery( ~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 @@ -501,6 +531,7 @@ def prepare_request(next_link=None): 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) @@ -512,6 +543,7 @@ def prepare_request(next_link=None): 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) @@ -529,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]: @@ -542,4 +578,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_image_versions_operations.py index 15f19367606e..97729da4853d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -146,8 +151,9 @@ async def begin_create_or_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -161,6 +167,7 @@ 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 @@ -185,10 +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) + 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 + 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, @@ -205,6 +211,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -215,6 +222,7 @@ async def _update_initial( 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'], @@ -222,7 +230,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -236,7 +248,7 @@ async def _update_initial( 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 @@ -281,8 +293,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,6 +309,7 @@ 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 @@ -320,10 +334,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) + 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 + 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( @@ -347,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) @@ -360,6 +373,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -367,13 +382,18 @@ async def get( 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) - 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]: @@ -387,10 +407,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -404,6 +424,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -411,12 +433,17 @@ async def _delete_initial( 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) - 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]: @@ -426,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -462,7 +489,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -475,6 +503,7 @@ 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 ) @@ -495,10 +524,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) + 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 + 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( @@ -525,6 +553,8 @@ def list_by_gallery_image( ~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 @@ -538,6 +568,7 @@ def prepare_request(next_link=None): 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) @@ -550,6 +581,7 @@ def prepare_request(next_link=None): 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) @@ -567,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]: @@ -580,4 +616,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_images_operations.py index 783c9dd35522..2ad5b2a4c108 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,6 +157,7 @@ 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 @@ -175,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore async def _update_initial( self, @@ -194,6 +200,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -203,6 +210,7 @@ async def _update_initial( 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'], @@ -210,7 +218,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -224,7 +236,7 @@ async def _update_initial( 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 @@ -262,8 +274,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,6 +289,7 @@ 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 @@ -300,10 +314,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace_async async def get( @@ -333,18 +346,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + 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(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]: @@ -358,10 +378,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -374,18 +394,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -395,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -427,7 +454,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -439,6 +467,7 @@ 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 ) @@ -459,10 +488,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -484,6 +512,8 @@ def list_by_gallery( ~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 @@ -496,6 +526,7 @@ def prepare_request(next_link=None): 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) @@ -507,6 +538,7 @@ def prepare_request(next_link=None): 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) @@ -524,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]: @@ -537,4 +573,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_sharing_profile_operations.py index 3dfe38f51bd0..c2ef650450ca 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_sharing_profile_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_gallery_sharing_profile_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -59,6 +58,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -67,6 +67,7 @@ async def _update_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'], @@ -74,7 +75,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -92,7 +97,7 @@ async def _update_initial( 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 @@ -125,8 +130,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,7 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_images_operations.py index d6b528d2c88a..68896c13c350 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.Image] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.Image] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~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 @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~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 @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_log_analytics_operations.py index 823d8b396d82..2be71778a1a4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py index 274bb081b19a..1dd1140ba1a8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~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 @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_proximity_placement_groups_operations.py index b771671f0307..3cb6bfa80b51 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -230,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) @@ -243,18 +261,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -268,7 +293,7 @@ async def get( 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 @@ -285,6 +310,8 @@ def list_by_subscription( ~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 @@ -295,6 +322,7 @@ def prepare_request(next_link=None): 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) @@ -304,6 +332,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -321,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]: @@ -334,7 +367,7 @@ async def get_next(next_link=None): 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( @@ -353,6 +386,8 @@ def list_by_resource_group( ~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 @@ -364,6 +399,7 @@ def prepare_request(next_link=None): 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) @@ -374,6 +410,7 @@ def prepare_request(next_link=None): 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) @@ -391,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]: @@ -404,4 +445,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_resource_skus_operations.py index 2e2a91a84e80..0be74dc6031a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_resource_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -56,10 +54,10 @@ 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) @@ -67,6 +65,8 @@ def list( ~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 @@ -77,6 +77,7 @@ def prepare_request(next_link=None): 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'], @@ -88,6 +89,7 @@ def prepare_request(next_link=None): 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, @@ -107,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]: @@ -120,4 +126,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_point_collections_operations.py index bed047b8f6ff..4e82d34d8911 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_point_collections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -78,6 +77,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -86,6 +86,7 @@ async def create_or_update( 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'], @@ -93,7 +94,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -111,7 +116,7 @@ async def create_or_update( 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 @@ -141,6 +146,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -149,6 +155,7 @@ async def update( 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'], @@ -156,7 +163,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -170,10 +181,10 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -185,17 +196,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -205,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -234,7 +252,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -245,6 +264,7 @@ 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 ) @@ -265,10 +285,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore @distributed_trace_async async def get( @@ -285,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) @@ -298,18 +317,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -323,7 +349,7 @@ async def get( 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 @@ -343,6 +369,8 @@ def list( ~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 @@ -354,6 +382,7 @@ def prepare_request(next_link=None): 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) @@ -364,6 +393,7 @@ def prepare_request(next_link=None): 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) @@ -381,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]: @@ -394,7 +428,7 @@ async def get_next(next_link=None): 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( @@ -412,6 +446,8 @@ def list_all( ~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 @@ -422,6 +458,7 @@ def prepare_request(next_link=None): 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) @@ -431,6 +468,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -448,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]: @@ -461,4 +503,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_points_operations.py index 25251ceaaad4..afeffc3397ea 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_restore_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -69,6 +69,7 @@ async def _create_initial( 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'], @@ -76,7 +77,11 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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 [201]: @@ -90,7 +95,7 @@ async def _create_initial( 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 @@ -126,8 +131,9 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.RestorePoint] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,12 +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) + 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 + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -182,18 +188,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -203,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -234,7 +247,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -246,6 +260,7 @@ 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 ) @@ -266,10 +281,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore @distributed_trace_async async def get( @@ -298,18 +312,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -323,5 +344,5 @@ async def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py index 1de63639fd23..68b716a2202f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,7 +57,7 @@ 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) @@ -66,6 +65,8 @@ def list( ~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 @@ -77,6 +78,7 @@ def prepare_request(next_link=None): 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'], ) @@ -88,6 +90,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, location=location, + api_version=api_version, shared_to=shared_to, template_url=next_link, ) @@ -106,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]: @@ -119,7 +126,7 @@ async def get_next(next_link=None): 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( @@ -145,17 +152,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + 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(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,5 +183,5 @@ async def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py index 63f59eee3b02..e70e9d3895a0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -65,7 +64,7 @@ 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 @@ -74,6 +73,8 @@ def list( ~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 @@ -87,6 +88,7 @@ def prepare_request(next_link=None): 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'], ) @@ -100,6 +102,7 @@ def prepare_request(next_link=None): 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, ) @@ -118,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]: @@ -131,7 +138,7 @@ async def get_next(next_link=None): 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( @@ -167,6 +174,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -174,12 +183,17 @@ async def get( 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) - 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]: @@ -193,5 +207,5 @@ async def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py index 1e6e8c2254e9..42f08e0f27c7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_shared_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,7 +60,7 @@ 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 @@ -70,6 +69,8 @@ def list( ~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 @@ -82,6 +83,7 @@ def prepare_request(next_link=None): 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'], ) @@ -94,6 +96,7 @@ def prepare_request(next_link=None): 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, ) @@ -112,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]: @@ -125,7 +132,7 @@ async def get_next(next_link=None): 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( @@ -155,18 +162,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + 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(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]: @@ -180,5 +194,5 @@ async def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_ssh_public_keys_operations.py index 35852155172a..fb0a4867909a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,8 @@ def list_by_subscription( ~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 @@ -71,6 +72,7 @@ def prepare_request(next_link=None): 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) @@ -80,6 +82,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -97,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]: @@ -110,7 +117,7 @@ async def get_next(next_link=None): 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( @@ -130,6 +137,8 @@ def list_by_resource_group( ~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 @@ -141,6 +150,7 @@ def prepare_request(next_link=None): 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) @@ -151,6 +161,7 @@ def prepare_request(next_link=None): 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) @@ -168,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]: @@ -181,7 +196,7 @@ async def get_next(next_link=None): 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( @@ -210,6 +225,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -218,6 +234,7 @@ async def create( 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'], @@ -225,7 +242,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -243,7 +264,7 @@ async def create( 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 @@ -273,6 +294,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -281,6 +303,7 @@ async def update( 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'], @@ -288,7 +311,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +329,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -329,17 +356,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -349,7 +383,7 @@ 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 @@ -376,17 +410,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -400,7 +441,7 @@ async def get( 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 @@ -429,17 +470,24 @@ async def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -453,5 +501,5 @@ async def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_usage_operations.py index 393d5889c69d..ae49b5adfdc0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~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 @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extension_images_operations.py index 978946591b0b..54284f5251a2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + 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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + 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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extensions_operations.py index a6f8221e8c1a..bd57951736f4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_edge_zone_operations.py index 6e3118b4235b..8c2c5df7f220 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_edge_zone_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -80,6 +79,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( location=location, @@ -89,12 +90,17 @@ async def get( 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(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,7 +114,7 @@ async def get( 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 @@ -137,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) @@ -155,6 +162,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_list_request( location=location, @@ -163,6 +172,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -171,7 +181,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -185,7 +199,7 @@ async def list( 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 @@ -216,18 +230,25 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + 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(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]: @@ -241,7 +262,7 @@ async def list_offers( 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 @@ -268,17 +289,24 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + 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(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,7 +320,7 @@ async def list_publishers( 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 @@ -326,6 +354,8 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_list_skus_request( location=location, @@ -333,12 +363,17 @@ async def list_skus( 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(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]: @@ -352,5 +387,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_operations.py index ed2bf7f9714b..ccfa60dd52fb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + 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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + 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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + 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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_run_commands_operations.py index b6a35558271a..13debd18011e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -65,6 +64,8 @@ def list( ~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 @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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( @@ -142,17 +149,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -166,7 +180,7 @@ async def get( 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( @@ -175,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"] @@ -183,7 +199,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -192,6 +208,7 @@ async def _create_or_update_initial( 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'], @@ -199,7 +216,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -217,7 +238,7 @@ async def _create_or_update_initial( 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 @@ -227,6 +248,8 @@ async def begin_create_or_update( 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. @@ -240,6 +263,9 @@ 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 @@ -254,8 +280,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -269,6 +295,7 @@ async def begin_create_or_update( 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 ) @@ -292,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore async def _update_initial( self, @@ -303,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"] @@ -311,7 +339,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -320,6 +348,7 @@ async def _update_initial( 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'], @@ -327,7 +356,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,7 +374,7 @@ async def _update_initial( 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 @@ -351,6 +384,8 @@ async def begin_update( 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. @@ -363,6 +398,9 @@ 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 @@ -377,8 +415,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -392,6 +430,7 @@ async def begin_update( 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 ) @@ -415,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -433,18 +471,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -454,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -485,7 +530,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -497,6 +543,7 @@ 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 ) @@ -517,10 +564,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) + 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 + 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( @@ -539,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) @@ -552,19 +598,26 @@ async def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -578,7 +631,7 @@ async def get_by_virtual_machine( 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 @@ -595,7 +648,7 @@ 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 @@ -604,6 +657,8 @@ def list_by_virtual_machine( ~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 @@ -616,6 +671,7 @@ def prepare_request(next_link=None): 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'], ) @@ -628,6 +684,7 @@ def prepare_request(next_link=None): 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, ) @@ -646,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]: @@ -659,4 +720,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 77b792eba84e..db4a0bc1ffa9 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore async def _update_initial( self, @@ -192,6 +198,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -201,6 +208,7 @@ async def _update_initial( 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'], @@ -208,7 +216,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -264,8 +276,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,6 +291,7 @@ 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 @@ -302,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -320,18 +333,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -341,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -372,7 +392,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -384,6 +405,7 @@ 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 ) @@ -404,10 +426,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -426,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) @@ -439,19 +460,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -465,7 +493,7 @@ async def get( 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 @@ -488,6 +516,8 @@ def list( ~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 @@ -500,6 +530,7 @@ def prepare_request(next_link=None): 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) @@ -511,6 +542,7 @@ def prepare_request(next_link=None): 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) @@ -528,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]: @@ -541,4 +577,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 649895264bd2..7e79a289d931 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,12 +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) + 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 + 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, @@ -252,17 +267,24 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -272,11 +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 @distributed_trace_async - async def begin_start_extension_upgrade( + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -302,7 +324,8 @@ async def begin_start_extension_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -313,6 +336,7 @@ 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 ) @@ -333,10 +357,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) + 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 + 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( @@ -362,17 +385,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -386,5 +416,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 4c1f77747846..c64a50721a01 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -152,6 +158,7 @@ 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 @@ -176,10 +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) + 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 + 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, @@ -196,6 +202,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -206,6 +213,7 @@ async def _update_initial( 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'], @@ -213,7 +221,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +239,7 @@ async def _update_initial( 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 @@ -268,8 +280,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,6 +296,7 @@ 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 @@ -307,12 +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) + 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 + 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, @@ -326,6 +339,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -333,12 +348,17 @@ async def _delete_initial( 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) - 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]: @@ -348,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -382,7 +402,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -395,6 +416,7 @@ 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 ) @@ -415,10 +437,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) + 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 + 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( @@ -440,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) @@ -453,6 +474,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -460,13 +483,18 @@ async def get( 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) - 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]: @@ -480,7 +508,7 @@ async def get( 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 @@ -500,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) @@ -513,19 +541,26 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -539,5 +574,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index cde5eba345d2..ce88e6216c89 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -55,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"] @@ -63,7 +64,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -73,6 +74,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +82,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -98,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -109,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. @@ -123,6 +131,9 @@ 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 @@ -137,8 +148,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -153,6 +164,7 @@ async def begin_create_or_update( 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 ) @@ -176,10 +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) + 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 + 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, @@ -188,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"] @@ -196,7 +209,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -206,6 +219,7 @@ async def _update_initial( 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'], @@ -213,7 +227,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +245,7 @@ async def _update_initial( 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 @@ -238,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. @@ -252,6 +272,9 @@ 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 @@ -266,8 +289,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -282,6 +305,7 @@ async def begin_update( 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 ) @@ -305,12 +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) + 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 + 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, @@ -324,6 +347,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -331,12 +356,17 @@ async def _delete_initial( 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) - 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]: @@ -346,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -380,7 +410,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -393,6 +424,7 @@ 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 ) @@ -413,10 +445,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) + 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 + 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( @@ -438,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) @@ -451,6 +482,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -458,13 +491,18 @@ async def get( 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) - 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]: @@ -478,7 +516,7 @@ async def get( 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 @@ -498,7 +536,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -507,6 +545,8 @@ def list( ~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 @@ -520,6 +560,7 @@ def prepare_request(next_link=None): 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'], ) @@ -533,6 +574,7 @@ def prepare_request(next_link=None): 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, ) @@ -551,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]: @@ -564,4 +610,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index df619d9c212c..69c73bc0f34a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -62,6 +61,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -74,6 +74,7 @@ async def _reimage_initial( 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'], @@ -81,7 +82,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -112,6 +117,7 @@ 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. + 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 @@ -126,8 +132,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +147,7 @@ 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 @@ -161,12 +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) + 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 + 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, @@ -179,18 +186,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -200,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -232,7 +246,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -244,6 +259,7 @@ 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 ) @@ -264,12 +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) + 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 + 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, @@ -282,18 +297,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -303,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,7 +358,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -348,6 +371,7 @@ 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 ) @@ -368,10 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -387,6 +410,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -396,6 +420,7 @@ async def _update_initial( 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'], @@ -403,7 +428,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -421,7 +450,7 @@ async def _update_initial( 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 @@ -458,8 +487,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +502,7 @@ 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 @@ -496,12 +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) + 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 + 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, @@ -515,19 +545,26 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -537,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -558,7 +595,7 @@ 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. @@ -572,7 +609,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -585,6 +623,7 @@ 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 ) @@ -605,10 +644,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -629,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) @@ -642,19 +680,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -668,7 +713,7 @@ async def get( 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 @@ -698,18 +743,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -723,7 +775,7 @@ async def get_instance_view( 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 @@ -744,12 +796,13 @@ 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 @@ -758,6 +811,8 @@ def list( ~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 @@ -770,6 +825,7 @@ def prepare_request(next_link=None): 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, @@ -784,6 +840,7 @@ def prepare_request(next_link=None): 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, @@ -804,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]: @@ -817,9 +878,9 @@ async def get_next(next_link=None): 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, @@ -833,19 +894,26 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -855,11 +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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -879,7 +947,7 @@ 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. @@ -893,7 +961,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -906,6 +975,7 @@ 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 ) @@ -926,12 +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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -944,18 +1013,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -965,11 +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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -996,7 +1072,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -1008,6 +1085,7 @@ 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 ) @@ -1028,12 +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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1046,18 +1123,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1067,11 +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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1098,7 +1182,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -1110,6 +1195,7 @@ 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 ) @@ -1130,12 +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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1148,18 +1233,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1169,11 +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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1201,7 +1293,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -1213,6 +1306,7 @@ 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 ) @@ -1233,10 +1327,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) + 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 + 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( @@ -1258,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) @@ -1271,19 +1364,26 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -1297,10 +1397,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + 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( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1313,18 +1413,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1334,11 +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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1365,7 +1472,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -1377,6 +1485,7 @@ 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 ) @@ -1397,13 +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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1429,18 +1537,25 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -1450,7 +1565,7 @@ 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( @@ -1459,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"]] @@ -1467,7 +1584,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1476,6 +1593,7 @@ async def _run_command_initial( 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'], @@ -1483,7 +1601,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1499,7 +1621,7 @@ async def _run_command_initial( 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 @@ -1509,6 +1631,8 @@ async def begin_run_command( 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. @@ -1521,6 +1645,9 @@ 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 @@ -1535,8 +1662,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -1550,6 +1677,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1573,7 +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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_sets_operations.py index e084d00f7d68..67b9cca69f8b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~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 @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -139,6 +147,7 @@ async def _create_or_update_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'], @@ -146,7 +155,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -164,7 +177,7 @@ async def _create_or_update_initial( 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 @@ -197,8 +210,9 @@ async def begin_create_or_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -210,6 +224,7 @@ 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 @@ -234,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -252,6 +266,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -260,6 +275,7 @@ async def _update_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'], @@ -267,7 +283,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -281,7 +301,7 @@ async def _update_initial( 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 @@ -314,8 +334,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -327,6 +348,7 @@ 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 @@ -351,12 +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) + 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 + 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, @@ -369,18 +390,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -390,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -408,6 +436,7 @@ 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. @@ -421,7 +450,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -433,6 +463,7 @@ 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 ) @@ -453,10 +484,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -474,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) @@ -487,18 +517,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -512,10 +549,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -528,6 +565,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -539,6 +577,7 @@ async def _deallocate_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'], @@ -546,7 +585,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -556,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -575,7 +618,8 @@ 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. + :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 @@ -590,8 +634,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -603,6 +648,7 @@ 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 @@ -624,12 +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) + 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 + 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, @@ -643,6 +688,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -651,6 +697,7 @@ async def _delete_instances_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, @@ -659,7 +706,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -669,11 +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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -691,7 +742,7 @@ async def begin_delete_instances( :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. @@ -705,8 +756,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -719,6 +771,7 @@ 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 @@ -740,10 +793,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) + 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 + 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( @@ -769,17 +821,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -793,7 +852,7 @@ async def get_instance_view( 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 @@ -813,6 +872,8 @@ def list( ~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 @@ -824,6 +885,7 @@ def prepare_request(next_link=None): 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) @@ -834,6 +896,7 @@ def prepare_request(next_link=None): 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) @@ -851,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]: @@ -864,7 +931,7 @@ async def get_next(next_link=None): 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( @@ -882,6 +949,8 @@ def list_all( ~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 @@ -892,6 +961,7 @@ def prepare_request(next_link=None): 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) @@ -901,6 +971,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -918,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]: @@ -931,7 +1006,7 @@ async def get_next(next_link=None): 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( @@ -954,6 +1029,8 @@ def list_skus( ~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 @@ -966,6 +1043,7 @@ def prepare_request(next_link=None): 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) @@ -977,6 +1055,7 @@ def prepare_request(next_link=None): 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) @@ -994,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]: @@ -1007,7 +1090,7 @@ async def get_next(next_link=None): 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( @@ -1029,6 +1112,8 @@ def get_os_upgrade_history( ~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 @@ -1041,6 +1126,7 @@ def prepare_request(next_link=None): 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) @@ -1052,6 +1138,7 @@ def prepare_request(next_link=None): 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) @@ -1069,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]: @@ -1082,9 +1173,9 @@ async def get_next(next_link=None): 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, @@ -1098,6 +1189,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1109,6 +1201,7 @@ async def _power_off_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, @@ -1117,7 +1210,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1127,11 +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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1149,9 +1246,10 @@ 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. + :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 @@ -1166,8 +1264,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1180,6 +1279,7 @@ 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 @@ -1201,12 +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) + 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 + 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, @@ -1219,6 +1318,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1230,6 +1330,7 @@ async def _restart_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'], @@ -1237,7 +1338,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1247,11 +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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1264,7 +1369,8 @@ 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. + :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 @@ -1279,8 +1385,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1292,6 +1399,7 @@ 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 @@ -1313,12 +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) + 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 + 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, @@ -1331,6 +1438,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1342,6 +1450,7 @@ async def _start_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'], @@ -1349,7 +1458,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1359,11 +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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1376,7 +1489,8 @@ 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. + :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 @@ -1391,8 +1505,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1404,6 +1519,7 @@ 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 @@ -1425,12 +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) + 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 + 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, @@ -1443,6 +1558,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1454,6 +1570,7 @@ async def _redeploy_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'], @@ -1461,7 +1578,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1471,11 +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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1489,7 +1610,8 @@ 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. + :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 @@ -1504,8 +1626,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1517,6 +1640,7 @@ 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 @@ -1538,12 +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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1556,6 +1679,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1567,6 +1691,7 @@ async def _perform_maintenance_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'], @@ -1574,7 +1699,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1584,11 +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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1604,7 +1733,8 @@ 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. + :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 @@ -1619,8 +1749,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1632,6 +1763,7 @@ 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 @@ -1653,12 +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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1671,6 +1802,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -1679,6 +1811,7 @@ async def _update_instances_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'], @@ -1686,7 +1819,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1696,11 +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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1728,8 +1865,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1741,6 +1879,7 @@ 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 @@ -1762,12 +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) + 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 + 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, @@ -1780,6 +1918,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -1791,6 +1930,7 @@ async def _reimage_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'], @@ -1798,7 +1938,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1808,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1827,7 +1971,7 @@ 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. + :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 @@ -1842,8 +1986,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1855,6 +2000,7 @@ 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 @@ -1876,12 +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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1894,6 +2039,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1905,6 +2051,7 @@ async def _reimage_all_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'], @@ -1912,7 +2059,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1922,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1940,7 +2091,8 @@ 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. + :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 @@ -1955,8 +2107,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1968,6 +2121,7 @@ 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 @@ -1989,10 +2143,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) + 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 + 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( @@ -2023,18 +2176,25 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -2048,11 +2208,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + async def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2079,6 +2239,7 @@ async def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + 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, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2087,6 +2248,7 @@ async def convert_to_single_placement_group( 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'], @@ -2094,7 +2256,11 @@ async def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2104,10 +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, @@ -2120,6 +2286,7 @@ async def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -2128,6 +2295,7 @@ async def _set_orchestration_service_state_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'], @@ -2135,7 +2303,11 @@ async def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2145,11 +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 @distributed_trace_async - async def begin_set_orchestration_service_state( + async def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2176,8 +2348,9 @@ async def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2189,6 +2362,7 @@ 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 @@ -2210,7 +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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_sizes_operations.py index 3ec3c27b5127..ce51b1093671 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -64,6 +62,8 @@ def list( ~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 @@ -75,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -85,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -102,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]: @@ -115,4 +121,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machines_operations.py index b42ebabc9728..a756a259979e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~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 @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -318,8 +338,9 @@ async def begin_create_or_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,6 +352,7 @@ 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 @@ -355,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -373,6 +394,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -381,6 +403,7 @@ async def _update_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'], @@ -388,7 +411,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -402,7 +429,7 @@ async def _update_initial( 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 @@ -435,8 +462,9 @@ async def begin_update( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -448,6 +476,7 @@ 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 @@ -472,12 +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) + 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 + 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, @@ -490,18 +518,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -511,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -528,7 +563,8 @@ 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. @@ -542,7 +578,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -554,6 +591,7 @@ 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 ) @@ -574,10 +612,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -597,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) @@ -609,18 +647,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -634,7 +679,7 @@ async def get( 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 @@ -661,17 +706,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -685,10 +737,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -700,17 +752,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -720,11 +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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -749,7 +808,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -760,6 +820,7 @@ 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 ) @@ -780,12 +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) + 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 + 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, @@ -798,18 +858,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -819,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -838,6 +905,7 @@ 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. @@ -851,7 +919,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -863,6 +932,7 @@ 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 ) @@ -883,13 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -917,17 +986,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -937,7 +1013,7 @@ 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 @@ -958,6 +1034,8 @@ def list( ~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 @@ -969,6 +1047,7 @@ def prepare_request(next_link=None): 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) @@ -979,6 +1058,7 @@ def prepare_request(next_link=None): 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) @@ -996,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]: @@ -1009,7 +1093,7 @@ async def get_next(next_link=None): 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( @@ -1021,7 +1105,7 @@ 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 @@ -1030,6 +1114,8 @@ def list_all( ~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 @@ -1040,6 +1126,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1050,6 +1137,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1068,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]: @@ -1081,7 +1173,7 @@ async def get_next(next_link=None): 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( @@ -1104,6 +1196,8 @@ def list_available_sizes( ~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 @@ -1116,6 +1210,7 @@ def prepare_request(next_link=None): 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) @@ -1127,6 +1222,7 @@ def prepare_request(next_link=None): 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) @@ -1144,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]: @@ -1157,9 +1257,9 @@ async def get_next(next_link=None): 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, @@ -1172,18 +1272,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -1193,11 +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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1213,7 +1320,7 @@ 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. @@ -1227,7 +1334,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -1239,6 +1347,7 @@ 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 ) @@ -1259,12 +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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _reapply_initial( + async def _reapply_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1276,17 +1384,24 @@ async def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -1296,11 +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 @distributed_trace_async - async def begin_reapply( + async def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1324,7 +1439,8 @@ async def begin_reapply( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -1335,6 +1451,7 @@ 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 ) @@ -1355,12 +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) + 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 + begin_reapply.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1372,17 +1488,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -1392,11 +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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1420,7 +1543,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -1431,6 +1555,7 @@ 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 ) @@ -1451,12 +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) + 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 + 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, @@ -1468,17 +1592,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -1488,11 +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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1516,7 +1647,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -1527,6 +1659,7 @@ 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 ) @@ -1547,12 +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) + 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 + 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, @@ -1564,17 +1696,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -1584,11 +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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1612,7 +1751,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -1623,6 +1763,7 @@ 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 ) @@ -1643,12 +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) + 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 + 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, @@ -1661,6 +1801,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1672,6 +1813,7 @@ async def _reimage_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'], @@ -1679,7 +1821,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1689,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1706,7 +1852,8 @@ 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. @@ -1720,8 +1867,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1733,6 +1881,7 @@ 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 @@ -1754,10 +1903,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) + 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 + 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( @@ -1775,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) @@ -1788,18 +1936,25 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + 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_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) - 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]: @@ -1813,10 +1968,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1828,17 +1983,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -1848,11 +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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1876,7 +2038,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -1887,6 +2050,7 @@ 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 ) @@ -1907,13 +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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1936,17 +2099,24 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -1956,7 +2126,7 @@ 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( @@ -1971,17 +2141,24 @@ async def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -1997,7 +2174,7 @@ async def _assess_patches_initial( 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 @@ -2027,7 +2204,8 @@ async def begin_assess_patches( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -2038,6 +2216,7 @@ 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 ) @@ -2061,10 +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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore async def _install_patches_initial( self, @@ -2079,6 +2257,7 @@ async def _install_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -2087,6 +2266,7 @@ async def _install_patches_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'], @@ -2094,7 +2274,11 @@ async def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2110,7 +2294,7 @@ async def _install_patches_initial( 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 @@ -2144,8 +2328,9 @@ async def begin_install_patches( ~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, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2157,6 +2342,7 @@ 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 @@ -2181,16 +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) + 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 + 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"]] @@ -2199,7 +2386,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2207,6 +2394,7 @@ async def _run_command_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'], @@ -2214,7 +2402,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2230,7 +2422,7 @@ async def _run_command_initial( 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 @@ -2239,6 +2431,8 @@ async def begin_run_command( 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. @@ -2249,6 +2443,9 @@ 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 @@ -2263,8 +2460,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_07_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + 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( 'polling_interval', @@ -2277,6 +2474,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2300,7 +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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_compute_management_client_enums.py index 474ca22c62b5..25c2f72f49ed 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_compute_management_client_enums.py @@ -351,7 +351,6 @@ class OrchestrationServiceNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enu """ AUTOMATIC_REPAIRS = "AutomaticRepairs" - DUMMY_ORCHESTRATION_SERVICE_NAME = "DummyOrchestrationServiceName" class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py index ac796fe3957b..ec8a94f34025 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/models/_models_py3.py @@ -6534,7 +6534,7 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :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". @@ -6560,7 +6560,7 @@ def __init__( ): """ :keyword service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :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", @@ -6578,8 +6578,7 @@ class OrchestrationServiceSummary(msrest.serialization.Model): 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". + :ivar service_name: The name of the service. Possible values include: "AutomaticRepairs". :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". diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_availability_sets_operations.py index 0a59a5982507..ad4ffa956aa8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_availability_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -150,31 +151,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -185,31 +187,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -253,31 +257,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,6 +335,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -338,6 +344,7 @@ def create_or_update( 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'], @@ -345,7 +352,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -359,7 +370,7 @@ def create_or_update( 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 @@ -389,6 +400,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -397,6 +409,7 @@ def update( 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'], @@ -404,7 +417,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +435,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -445,17 +462,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -465,7 +489,7 @@ 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 @@ -492,17 +516,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -516,7 +547,7 @@ def get( 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 @@ -528,7 +559,7 @@ 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 @@ -537,6 +568,8 @@ def list_by_subscription( ~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 @@ -547,6 +580,7 @@ def prepare_request(next_link=None): 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'], ) @@ -557,6 +591,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -575,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]: @@ -588,7 +627,7 @@ def get_next(next_link=None): 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( @@ -607,6 +646,8 @@ def list( ~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 @@ -618,6 +659,7 @@ def prepare_request(next_link=None): 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) @@ -628,6 +670,7 @@ def prepare_request(next_link=None): 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) @@ -645,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]: @@ -658,7 +705,7 @@ def get_next(next_link=None): 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( @@ -681,6 +728,8 @@ def list_available_sizes( ~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 @@ -693,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservation_groups_operations.py index 13aa94191423..dce8153fd383 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservation_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,31 +121,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,33 +159,34 @@ def build_get_request( expand: Optional[Union[str, "_models.CapacityReservationGroupInstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,32 +198,33 @@ def build_list_by_resource_group_request( expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -232,31 +235,32 @@ def build_list_by_subscription_request( expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -311,6 +315,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -319,6 +324,7 @@ def create_or_update( 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'], @@ -326,7 +332,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -344,7 +354,7 @@ def create_or_update( 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 @@ -375,6 +385,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -383,6 +394,7 @@ def update( 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'], @@ -390,7 +402,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -404,11 +420,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -434,17 +450,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -454,7 +477,7 @@ 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 @@ -474,7 +497,7 @@ 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. + 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 @@ -488,18 +511,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -513,7 +543,7 @@ def get( 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 @@ -530,7 +560,7 @@ 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. + 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 @@ -540,6 +570,8 @@ def list_by_resource_group( ~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 @@ -551,6 +583,7 @@ def prepare_request(next_link=None): 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'], ) @@ -562,6 +595,7 @@ def prepare_request(next_link=None): 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, ) @@ -580,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]: @@ -593,7 +631,7 @@ def get_next(next_link=None): 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( @@ -606,7 +644,7 @@ 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. + 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 @@ -616,6 +654,8 @@ def list_by_subscription( ~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 @@ -626,6 +666,7 @@ def prepare_request(next_link=None): 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'], ) @@ -636,6 +677,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -654,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]: @@ -667,4 +713,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservations_operations.py index 061cc6a01d26..36d82ea65552 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_capacity_reservations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -139,21 +140,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -167,10 +168,11 @@ def build_get_request( expand: Optional[Union[str, "_models.CapacityReservationInstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -178,23 +180,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -205,31 +207,32 @@ def build_list_by_capacity_reservation_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -269,6 +272,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -278,6 +282,7 @@ def _create_or_update_initial( 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'], @@ -285,7 +290,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -303,7 +312,7 @@ def _create_or_update_initial( 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 @@ -341,8 +350,9 @@ def begin_create_or_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -355,6 +365,7 @@ 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 @@ -379,10 +390,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore def _update_initial( self, @@ -398,6 +408,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -407,6 +418,7 @@ def _update_initial( 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'], @@ -414,7 +426,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -430,7 +446,7 @@ def _update_initial( 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 @@ -466,8 +482,9 @@ def begin_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -480,6 +497,7 @@ 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 @@ -504,12 +522,11 @@ 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) + 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 + 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: str, capacity_reservation_group_name: str, @@ -522,18 +539,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -543,11 +567,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -576,7 +600,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -588,6 +613,7 @@ 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 ) @@ -608,10 +634,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore @distributed_trace def get( @@ -632,7 +657,7 @@ 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. + 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 @@ -646,19 +671,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -672,7 +704,7 @@ def get( 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 @@ -696,6 +728,8 @@ def list_by_capacity_reservation_group( ~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 @@ -708,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -719,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -736,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]: @@ -749,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py index e83842f23440..06b2dd5d9f99 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,31 +31,32 @@ def build_get_request( public_gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -105,17 +106,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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(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]: @@ -129,5 +137,5 @@ def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py index 2981f2073905..f7a404a348e6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( gallery_image_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -118,6 +119,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -125,12 +128,17 @@ def get( 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) - 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]: @@ -144,5 +152,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py index 9447656ae5d8..b03a59a64fea 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_community_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,10 +32,11 @@ def build_get_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -43,21 +44,21 @@ def build_get_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,18 +111,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + 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(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]: @@ -135,5 +143,5 @@ def get( 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_host_groups_operations.py index 98ab137ede06..3c4b5cda87a1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_host_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -188,30 +190,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -220,29 +223,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -297,6 +301,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -305,6 +310,7 @@ def create_or_update( 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'], @@ -312,7 +318,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -330,7 +340,7 @@ def create_or_update( 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 @@ -360,6 +370,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -368,6 +379,7 @@ def update( 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'], @@ -375,7 +387,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -389,11 +405,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -416,17 +432,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -436,7 +459,7 @@ 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 @@ -455,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) @@ -468,18 +491,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -493,7 +523,7 @@ def get( 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 @@ -514,6 +544,8 @@ def list_by_resource_group( ~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 @@ -525,6 +557,7 @@ def prepare_request(next_link=None): 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) @@ -535,6 +568,7 @@ def prepare_request(next_link=None): 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) @@ -552,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]: @@ -565,7 +603,7 @@ def get_next(next_link=None): 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( @@ -582,6 +620,8 @@ def list_by_subscription( ~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 @@ -592,6 +632,7 @@ def prepare_request(next_link=None): 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) @@ -601,6 +642,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -618,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]: @@ -631,4 +677,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_hosts_operations.py index 45ffe9386de8..f14fd5584084 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_dedicated_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_by_host_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -332,8 +341,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -346,6 +356,7 @@ 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 @@ -370,10 +381,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore def _update_initial( self, @@ -389,6 +399,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -398,6 +409,7 @@ def _update_initial( 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'], @@ -405,7 +417,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,7 +435,7 @@ def _update_initial( 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 @@ -454,8 +470,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -468,6 +485,7 @@ 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 @@ -492,12 +510,11 @@ 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) + 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 + 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: str, host_group_name: str, @@ -510,18 +527,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -531,11 +555,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -562,7 +586,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -574,6 +599,7 @@ 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 ) @@ -594,10 +620,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace def get( @@ -618,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) @@ -631,19 +656,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -657,7 +689,7 @@ def get( 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 @@ -681,6 +713,8 @@ def list_by_host_group( ~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 @@ -693,6 +727,7 @@ def prepare_request(next_link=None): 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) @@ -704,6 +739,7 @@ def prepare_request(next_link=None): 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) @@ -721,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]: @@ -734,4 +774,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_galleries_operations.py index 00698b6284d4..3aa087fa2c61 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -125,33 +125,34 @@ def build_get_request( select: Optional[Union[str, "_models.SelectPermissions"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,31 +163,32 @@ def build_delete_request_initial( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,30 +198,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -228,29 +231,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -289,6 +293,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -297,6 +302,7 @@ def _create_or_update_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'], @@ -304,7 +310,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -325,7 +335,7 @@ def _create_or_update_initial( 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 @@ -357,8 +367,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.Gallery] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -370,6 +381,7 @@ 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 @@ -394,10 +406,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore def _update_initial( self, @@ -412,6 +423,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -420,6 +432,7 @@ def _update_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'], @@ -427,7 +440,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -441,7 +458,7 @@ def _update_initial( 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 @@ -473,8 +490,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.Gallery] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,6 +504,7 @@ 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 @@ -510,10 +529,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def get( @@ -529,7 +547,7 @@ 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) @@ -542,18 +560,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + api_version=api_version, select=select, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -567,10 +592,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -582,17 +607,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -602,11 +634,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -630,7 +662,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -641,6 +674,7 @@ 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 ) @@ -661,10 +695,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -681,6 +714,8 @@ 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 @@ -692,6 +727,7 @@ def prepare_request(next_link=None): 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) @@ -702,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -719,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]: @@ -732,7 +773,7 @@ def get_next(next_link=None): 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( @@ -746,6 +787,8 @@ 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 @@ -756,6 +799,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -765,6 +809,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -782,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]: @@ -795,4 +844,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_application_versions_operations.py index 29db6b831dac..1fe2b9b8da5e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_application_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -135,10 +135,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -147,23 +148,23 @@ def build_get_request( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -176,10 +177,11 @@ def build_delete_request_initial( gallery_application_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -188,21 +190,21 @@ def build_delete_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -214,10 +216,11 @@ def build_list_by_gallery_application_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -225,21 +228,21 @@ def build_list_by_gallery_application_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -280,6 +283,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -290,6 +294,7 @@ def _create_or_update_initial( 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'], @@ -297,7 +302,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -364,8 +373,9 @@ def begin_create_or_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -379,6 +389,7 @@ 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 @@ -403,10 +414,9 @@ 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) + 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 + 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, @@ -423,6 +433,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -433,6 +444,7 @@ def _update_initial( 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'], @@ -440,7 +452,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -454,7 +470,7 @@ def _update_initial( 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 @@ -500,8 +516,9 @@ def begin_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -515,6 +532,7 @@ 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 @@ -539,10 +557,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore @distributed_trace def get( @@ -567,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) @@ -580,6 +597,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -587,13 +606,18 @@ def get( 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) - 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]: @@ -607,10 +631,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -624,6 +648,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -631,12 +657,17 @@ def _delete_initial( 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) - 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]: @@ -646,11 +677,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -683,7 +714,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -696,6 +728,7 @@ 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 ) @@ -716,10 +749,9 @@ 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) + 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 + 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( @@ -746,6 +778,8 @@ def list_by_gallery_application( ~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 @@ -759,6 +793,7 @@ def prepare_request(next_link=None): 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) @@ -771,6 +806,7 @@ def prepare_request(next_link=None): 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) @@ -788,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]: @@ -801,4 +841,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_applications_operations.py index 43bb19d8b781..971cff7faf6d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_get_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -139,21 +140,21 @@ def build_get_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,10 +166,11 @@ def build_delete_request_initial( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -176,21 +178,21 @@ def build_delete_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -201,31 +203,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,6 +268,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -274,6 +278,7 @@ def _create_or_update_initial( 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'], @@ -281,7 +286,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -302,7 +311,7 @@ def _create_or_update_initial( 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 @@ -342,8 +351,9 @@ def begin_create_or_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -356,6 +366,7 @@ 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 @@ -380,10 +391,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore def _update_initial( self, @@ -399,6 +409,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -408,6 +419,7 @@ def _update_initial( 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'], @@ -415,7 +427,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -429,7 +445,7 @@ def _update_initial( 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 @@ -468,8 +484,9 @@ def begin_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -482,6 +499,7 @@ 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 @@ -506,10 +524,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def get( @@ -540,18 +557,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + 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(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]: @@ -565,10 +589,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -581,18 +605,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -602,11 +633,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -634,7 +665,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -646,6 +678,7 @@ 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 ) @@ -666,10 +699,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -692,6 +724,8 @@ def list_by_gallery( ~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 @@ -704,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -715,6 +750,7 @@ def prepare_request(next_link=None): 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) @@ -732,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]: @@ -745,4 +785,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_image_versions_operations.py index a440e286d719..200ca7d17539 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -135,10 +135,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -147,23 +148,23 @@ def build_get_request( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -176,10 +177,11 @@ def build_delete_request_initial( gallery_image_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -188,21 +190,21 @@ def build_delete_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -214,10 +216,11 @@ def build_list_by_gallery_image_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -225,21 +228,21 @@ def build_list_by_gallery_image_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -280,6 +283,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -290,6 +294,7 @@ def _create_or_update_initial( 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'], @@ -297,7 +302,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -363,8 +372,9 @@ def begin_create_or_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -378,6 +388,7 @@ 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 @@ -402,10 +413,9 @@ 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) + 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 + 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, @@ -422,6 +432,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -432,6 +443,7 @@ def _update_initial( 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'], @@ -439,7 +451,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -453,7 +469,7 @@ def _update_initial( 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 @@ -498,8 +514,9 @@ def begin_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -513,6 +530,7 @@ 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 @@ -537,10 +555,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore @distributed_trace def get( @@ -564,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) @@ -577,6 +594,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -584,13 +603,18 @@ def get( 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) - 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]: @@ -604,10 +628,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -621,6 +645,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -628,12 +654,17 @@ def _delete_initial( 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) - 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]: @@ -643,11 +674,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -679,7 +710,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -692,6 +724,7 @@ 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 ) @@ -712,10 +745,9 @@ 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) + 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 + 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( @@ -742,6 +774,8 @@ def list_by_gallery_image( ~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 @@ -755,6 +789,7 @@ def prepare_request(next_link=None): 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) @@ -767,6 +802,7 @@ def prepare_request(next_link=None): 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) @@ -784,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]: @@ -797,4 +837,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_images_operations.py index 547e7b2039da..0103c3ae8bf4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_get_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -139,21 +140,21 @@ def build_get_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,10 +166,11 @@ def build_delete_request_initial( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -176,21 +178,21 @@ def build_delete_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -201,31 +203,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,6 +268,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -274,6 +278,7 @@ def _create_or_update_initial( 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'], @@ -281,7 +286,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -302,7 +311,7 @@ def _create_or_update_initial( 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 @@ -340,8 +349,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -354,6 +364,7 @@ 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 @@ -378,10 +389,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore def _update_initial( self, @@ -397,6 +407,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -406,6 +417,7 @@ def _update_initial( 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'], @@ -413,7 +425,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.GalleryImage] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,10 +521,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def get( @@ -536,18 +553,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + 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(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]: @@ -561,10 +585,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -577,18 +601,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -598,11 +629,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -630,7 +661,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -642,6 +674,7 @@ 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 ) @@ -662,10 +695,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -686,6 +718,8 @@ 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 @@ -698,6 +732,7 @@ def prepare_request(next_link=None): 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) @@ -709,6 +744,7 @@ def prepare_request(next_link=None): 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) @@ -726,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]: @@ -739,4 +779,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_sharing_profile_operations.py index 2c94646422c3..8e1f35339773 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_sharing_profile_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_gallery_sharing_profile_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,35 +37,35 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -106,6 +106,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -114,6 +115,7 @@ def _update_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'], @@ -121,7 +123,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -139,7 +145,7 @@ def _update_initial( 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 @@ -171,8 +177,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( 'polling_interval', @@ -184,6 +191,7 @@ 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 @@ -208,7 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_images_operations.py index 3171e1e92c68..636b6e2f52da 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,25 +123,26 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -154,33 +155,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,30 +192,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -222,29 +225,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +287,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -291,6 +296,7 @@ def _create_or_update_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'], @@ -298,7 +304,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -316,7 +326,7 @@ def _create_or_update_initial( 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 @@ -347,8 +357,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.Image] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -360,6 +371,7 @@ 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 @@ -384,10 +396,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -402,6 +413,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -410,6 +422,7 @@ def _update_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'], @@ -417,7 +430,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -435,7 +452,7 @@ def _update_initial( 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 @@ -466,8 +483,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.Image] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +497,7 @@ 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 @@ -503,12 +522,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -520,17 +538,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -540,11 +565,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -568,7 +593,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -579,6 +605,7 @@ 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 ) @@ -599,10 +626,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -618,7 +644,7 @@ 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) @@ -631,18 +657,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -656,7 +689,7 @@ def get( 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 @@ -674,6 +707,8 @@ 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 @@ -685,6 +720,7 @@ def prepare_request(next_link=None): 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) @@ -695,6 +731,7 @@ def prepare_request(next_link=None): 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) @@ -712,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]: @@ -725,7 +766,7 @@ def get_next(next_link=None): 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( @@ -740,6 +781,8 @@ 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 @@ -750,6 +793,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -759,6 +803,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -776,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]: @@ -789,4 +838,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_log_analytics_operations.py index 6eb901ec6565..06bd0d0a46fe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_log_analytics_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py index fa5a49904547..036fd0efac81 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~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 @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_proximity_placement_groups_operations.py index f7bc61bc5f23..23bdc4d7fd8d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_proximity_placement_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,25 +121,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -152,33 +153,34 @@ def build_get_request( include_colocation_status: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -187,29 +189,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -219,30 +222,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -295,6 +299,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -303,6 +308,7 @@ def create_or_update( 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'], @@ -310,7 +316,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -328,7 +338,7 @@ def create_or_update( 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 @@ -358,6 +368,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -366,6 +377,7 @@ def update( 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'], @@ -373,7 +385,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -387,11 +403,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -414,17 +430,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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,7 +457,7 @@ 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 @@ -452,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) @@ -465,18 +488,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -490,7 +520,7 @@ def get( 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 @@ -507,6 +537,8 @@ def list_by_subscription( ~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 @@ -517,6 +549,7 @@ def prepare_request(next_link=None): 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) @@ -526,6 +559,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -543,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]: @@ -556,7 +594,7 @@ def get_next(next_link=None): 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( @@ -575,6 +613,8 @@ def list_by_resource_group( ~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 @@ -586,6 +626,7 @@ def prepare_request(next_link=None): 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) @@ -596,6 +637,7 @@ def prepare_request(next_link=None): 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) @@ -613,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]: @@ -626,4 +672,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_resource_skus_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_resource_skus_operations.py index 5666829e666c..79c71638f68b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_resource_skus_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_resource_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,33 +33,34 @@ def build_list_request( include_extended_locations: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -95,16 +96,18 @@ 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.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 @@ -115,6 +118,7 @@ def prepare_request(next_link=None): 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'], @@ -126,6 +130,7 @@ def prepare_request(next_link=None): 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, @@ -145,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]: @@ -158,4 +167,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_point_collections_operations.py index 775f82358931..3a47768cfa16 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_point_collections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( restore_point_collection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -160,33 +161,34 @@ def build_get_request( expand: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,30 +198,31 @@ def build_list_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -228,29 +231,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -306,6 +310,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -314,6 +319,7 @@ def create_or_update( 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'], @@ -321,7 +327,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -339,7 +349,7 @@ def create_or_update( 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 @@ -369,6 +379,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -377,6 +388,7 @@ def update( 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'], @@ -384,7 +396,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -398,10 +414,10 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -413,17 +429,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -433,11 +456,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -462,7 +485,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -473,6 +497,7 @@ 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 ) @@ -493,10 +518,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore @distributed_trace def get( @@ -513,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) @@ -526,18 +550,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -551,7 +582,7 @@ def get( 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 @@ -571,6 +602,8 @@ def list( ~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 @@ -582,6 +615,7 @@ def prepare_request(next_link=None): 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) @@ -592,6 +626,7 @@ def prepare_request(next_link=None): 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) @@ -609,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]: @@ -622,7 +661,7 @@ def get_next(next_link=None): 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( @@ -640,6 +679,8 @@ def list_all( ~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 @@ -650,6 +691,7 @@ def prepare_request(next_link=None): 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) @@ -659,6 +701,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -676,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]: @@ -689,4 +736,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_points_operations.py index d211bb7c08ff..570b45ac1d1f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_restore_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + _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'), @@ -51,23 +51,23 @@ def build_create_request_initial( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -81,10 +81,11 @@ def build_delete_request_initial( restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -92,21 +93,21 @@ def build_delete_request_initial( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -118,10 +119,11 @@ def build_get_request( restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -129,21 +131,21 @@ def build_get_request( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -183,6 +185,7 @@ def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -192,6 +195,7 @@ def _create_initial( 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'], @@ -199,7 +203,11 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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 [201]: @@ -213,7 +221,7 @@ def _create_initial( 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 @@ -249,8 +257,9 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.RestorePoint] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +272,7 @@ 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 @@ -287,12 +297,11 @@ 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) + 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 + 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: str, restore_point_collection_name: str, @@ -305,18 +314,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -326,11 +342,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -357,7 +373,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -369,6 +386,7 @@ 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 ) @@ -389,10 +407,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore @distributed_trace def get( @@ -421,18 +438,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -446,5 +470,5 @@ def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py index c786acad5486..269fa40a66f0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,32 +33,33 @@ def build_list_request( shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -69,31 +70,32 @@ def build_get_request( gallery_unique_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -131,13 +133,15 @@ 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.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 @@ -149,6 +153,7 @@ def prepare_request(next_link=None): 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'], ) @@ -160,6 +165,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, location=location, + api_version=api_version, shared_to=shared_to, template_url=next_link, ) @@ -178,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]: @@ -191,7 +201,7 @@ def get_next(next_link=None): 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( @@ -217,17 +227,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + 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(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]: @@ -241,5 +258,5 @@ def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py index 8267b6dc6556..3ea64f2f3ee7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_image_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_list_request( shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -46,23 +47,23 @@ def build_list_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -75,10 +76,11 @@ def build_get_request( gallery_image_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -87,21 +89,21 @@ def build_get_request( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -146,7 +148,7 @@ 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 @@ -155,6 +157,8 @@ def list( ~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 @@ -168,6 +172,7 @@ def prepare_request(next_link=None): 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'], ) @@ -181,6 +186,7 @@ def prepare_request(next_link=None): 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, ) @@ -199,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]: @@ -212,7 +222,7 @@ def get_next(next_link=None): 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( @@ -248,6 +258,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -255,12 +267,17 @@ def get( 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) - 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]: @@ -274,5 +291,5 @@ def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py index 009f67a38b10..91abeef7335f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_shared_gallery_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,33 +34,34 @@ def build_list_request( shared_to: Optional[Union[str, "_models.SharedToValues"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,10 +73,11 @@ def build_get_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -83,21 +85,21 @@ def build_get_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -138,7 +140,7 @@ 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 @@ -147,6 +149,8 @@ def list( ~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 @@ -159,6 +163,7 @@ def prepare_request(next_link=None): 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'], ) @@ -171,6 +176,7 @@ def prepare_request(next_link=None): 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, ) @@ -189,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]: @@ -202,7 +212,7 @@ def get_next(next_link=None): 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( @@ -232,18 +242,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, + 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(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]: @@ -257,5 +274,5 @@ def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_ssh_public_keys_operations.py index cccabd6476ea..e877ffee7f62 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_ssh_public_keys_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,30 +64,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -100,35 +102,35 @@ def build_create_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -144,35 +146,35 @@ def build_update_request( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -185,25 +187,26 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -214,31 +217,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -249,31 +253,32 @@ def build_generate_key_pair_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -314,6 +319,8 @@ def list_by_subscription( ~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 @@ -324,6 +331,7 @@ def prepare_request(next_link=None): 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) @@ -333,6 +341,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -350,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]: @@ -363,7 +376,7 @@ def get_next(next_link=None): 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( @@ -383,6 +396,8 @@ def list_by_resource_group( ~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 @@ -394,6 +409,7 @@ def prepare_request(next_link=None): 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) @@ -404,6 +420,7 @@ def prepare_request(next_link=None): 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) @@ -421,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]: @@ -434,7 +455,7 @@ def get_next(next_link=None): 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( @@ -463,6 +484,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -471,6 +493,7 @@ def create( 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'], @@ -478,7 +501,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def create( 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 @@ -526,6 +553,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -534,6 +562,7 @@ def update( 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'], @@ -541,7 +570,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -555,11 +588,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -582,17 +615,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -602,7 +642,7 @@ 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 @@ -629,17 +669,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -653,7 +700,7 @@ def get( 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 @@ -682,17 +729,24 @@ def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -706,5 +760,5 @@ def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_usage_operations.py index 1342f68fcb1b..2b8b192f17c0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ 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 @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extension_images_operations.py index 87110a272a0f..620102d802bb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extension_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + 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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + 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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extensions_operations.py index 88735226ca2e..067540d860bf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,9 +127,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -137,16 +138,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -160,10 +161,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -171,23 +173,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -200,33 +202,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -266,6 +269,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -275,6 +279,7 @@ def _create_or_update_initial( 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'], @@ -282,7 +287,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -300,7 +309,7 @@ def _create_or_update_initial( 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 @@ -338,8 +347,9 @@ def begin_create_or_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,6 +362,7 @@ 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 @@ -376,10 +387,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -395,6 +405,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -404,6 +415,7 @@ def _update_initial( 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'], @@ -411,7 +423,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -425,7 +441,7 @@ def _update_initial( 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 @@ -463,8 +479,9 @@ def begin_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -477,6 +494,7 @@ 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 @@ -501,12 +519,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -519,18 +536,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -540,11 +564,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -571,7 +595,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -583,6 +608,7 @@ 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 ) @@ -603,10 +629,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -625,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) @@ -638,19 +663,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -664,7 +696,7 @@ def get( 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 @@ -681,7 +713,7 @@ 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) @@ -694,18 +726,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -719,5 +758,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_edge_zone_operations.py index 7fdd70192283..6af9783177c0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_edge_zone_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -49,21 +50,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -81,10 +82,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -94,27 +96,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -126,10 +128,11 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -137,21 +140,21 @@ def build_list_offers_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,31 +165,32 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,10 +203,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -211,21 +216,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -287,6 +292,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( location=location, @@ -296,12 +303,17 @@ def get( 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(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]: @@ -315,7 +327,7 @@ def get( 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 @@ -344,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) @@ -362,6 +375,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_list_request( location=location, @@ -370,6 +385,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -378,7 +394,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -392,7 +412,7 @@ def list( 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 @@ -423,18 +443,25 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + 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(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]: @@ -448,7 +475,7 @@ def list_offers( 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 @@ -475,17 +502,24 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + 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(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 +533,7 @@ def list_publishers( 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 @@ -533,6 +567,8 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_list_skus_request( location=location, @@ -540,12 +576,17 @@ def list_skus( 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(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]: @@ -559,5 +600,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_operations.py index c019ae119d32..fc2030fe5a47 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + 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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + 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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + 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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_run_commands_operations.py index 3f3ba2002b02..329cb6878519 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,31 +69,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -107,12 +109,12 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -120,23 +122,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -153,12 +155,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -166,23 +168,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -196,10 +198,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -207,21 +210,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -235,10 +238,11 @@ def build_get_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -246,23 +250,23 @@ def build_get_by_virtual_machine_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -275,33 +279,34 @@ def build_list_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -344,6 +349,8 @@ def list( ~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 @@ -355,6 +362,7 @@ def prepare_request(next_link=None): 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) @@ -365,6 +373,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -382,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]: @@ -395,7 +408,7 @@ def get_next(next_link=None): 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( @@ -421,17 +434,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -445,7 +465,7 @@ def get( 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( @@ -454,6 +474,8 @@ 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"] @@ -462,7 +484,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -471,6 +493,7 @@ def _create_or_update_initial( 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'], @@ -478,7 +501,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def _create_or_update_initial( 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 @@ -506,6 +533,8 @@ def begin_create_or_update( 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. @@ -519,6 +548,9 @@ 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 @@ -533,8 +565,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -548,6 +580,7 @@ def begin_create_or_update( 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 ) @@ -571,10 +604,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore def _update_initial( self, @@ -582,6 +614,8 @@ 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"] @@ -590,7 +624,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -599,6 +633,7 @@ def _update_initial( 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'], @@ -606,7 +641,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +659,7 @@ def _update_initial( 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 @@ -630,6 +669,8 @@ def begin_update( 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. @@ -642,6 +683,9 @@ 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 @@ -656,8 +700,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -671,6 +715,7 @@ def begin_update( 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 ) @@ -694,12 +739,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -712,18 +756,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -733,11 +784,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -764,7 +815,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -776,6 +828,7 @@ 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 ) @@ -796,10 +849,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get_by_virtual_machine( @@ -818,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) @@ -831,19 +883,26 @@ def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -857,7 +916,7 @@ def get_by_virtual_machine( 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 @@ -874,7 +933,7 @@ 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 @@ -883,6 +942,8 @@ def list_by_virtual_machine( ~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 @@ -895,6 +956,7 @@ def prepare_request(next_link=None): 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'], ) @@ -907,6 +969,7 @@ def prepare_request(next_link=None): 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, ) @@ -925,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]: @@ -938,4 +1005,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_extensions_operations.py index b21caa10d78e..73b6518464fb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,9 +128,10 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -138,16 +139,16 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -161,10 +162,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -172,23 +174,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,31 +201,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -263,6 +266,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -272,6 +276,7 @@ def _create_or_update_initial( 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'], @@ -279,7 +284,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -297,7 +306,7 @@ def _create_or_update_initial( 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 @@ -336,8 +345,9 @@ def begin_create_or_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -350,6 +360,7 @@ 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 @@ -374,10 +385,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore def _update_initial( self, @@ -393,6 +403,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -402,6 +413,7 @@ def _update_initial( 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'], @@ -409,7 +421,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,12 +521,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -521,18 +538,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -542,11 +566,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -573,7 +597,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -585,6 +610,7 @@ 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 ) @@ -605,10 +631,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -627,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) @@ -640,19 +665,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -666,7 +698,7 @@ def get( 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 @@ -689,6 +721,8 @@ def list( ~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 @@ -701,6 +735,7 @@ def prepare_request(next_link=None): 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) @@ -712,6 +747,7 @@ def prepare_request(next_link=None): 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) @@ -729,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]: @@ -742,4 +782,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index d6df0c4f29e1..790d848466bb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,25 +33,26 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -62,25 +63,26 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -91,25 +93,26 @@ def build_start_extension_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -120,31 +123,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -170,7 +174,7 @@ 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: str, vm_scale_set_name: str, @@ -182,17 +186,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -202,11 +213,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -230,7 +241,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -241,6 +253,7 @@ 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 ) @@ -261,12 +274,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -278,17 +290,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -298,11 +317,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -328,7 +347,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -339,6 +359,7 @@ 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 ) @@ -359,12 +380,11 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def _start_extension_upgrade_initial( + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -376,17 +396,24 @@ def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -396,11 +423,11 @@ 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 @distributed_trace - def begin_start_extension_upgrade( + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -426,7 +453,8 @@ def begin_start_extension_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -437,6 +465,7 @@ 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 ) @@ -457,10 +486,9 @@ 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) + 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 + begin_start_extension_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -486,17 +514,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -510,5 +545,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 77612a2e60bb..cf9575d49762 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -53,23 +53,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -87,12 +87,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -101,23 +101,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -132,10 +132,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -144,21 +145,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -173,10 +174,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -185,23 +187,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,10 +217,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -226,23 +229,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +286,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -293,6 +297,7 @@ def _create_or_update_initial( 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'], @@ -300,7 +305,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -359,8 +368,9 @@ def begin_create_or_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -374,6 +384,7 @@ 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 @@ -398,10 +409,9 @@ 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) + 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 + 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, @@ -418,6 +428,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -428,6 +439,7 @@ def _update_initial( 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'], @@ -435,7 +447,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -449,7 +465,7 @@ def _update_initial( 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 @@ -490,8 +506,9 @@ def begin_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -505,6 +522,7 @@ 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 @@ -529,12 +547,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -548,6 +565,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -555,12 +574,17 @@ def _delete_initial( 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) - 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]: @@ -570,11 +594,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -604,7 +628,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -617,6 +642,7 @@ 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 ) @@ -637,10 +663,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -662,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) @@ -675,6 +700,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -682,13 +709,18 @@ def get( 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) - 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]: @@ -702,7 +734,7 @@ def get( 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 @@ -722,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) @@ -735,19 +767,26 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -761,5 +800,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 026a50d23f7f..ec02c9228a94 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -133,10 +133,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -145,21 +146,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -174,10 +175,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -186,23 +188,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -216,10 +218,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -227,23 +230,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -276,6 +279,8 @@ 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"] @@ -284,7 +289,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -294,6 +299,7 @@ def _create_or_update_initial( 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'], @@ -301,7 +307,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -319,7 +329,7 @@ def _create_or_update_initial( 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 @@ -330,6 +340,8 @@ def begin_create_or_update( 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. @@ -344,6 +356,9 @@ 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 @@ -358,8 +373,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -374,6 +389,7 @@ def begin_create_or_update( 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 ) @@ -397,10 +413,9 @@ 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) + 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 + 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, @@ -409,6 +424,8 @@ 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"] @@ -417,7 +434,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -427,6 +444,7 @@ def _update_initial( 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'], @@ -434,7 +452,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -448,7 +470,7 @@ def _update_initial( 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 @@ -459,6 +481,8 @@ def begin_update( 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. @@ -473,6 +497,9 @@ 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 @@ -487,8 +514,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -503,6 +530,7 @@ def begin_update( 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 ) @@ -526,12 +554,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -545,6 +572,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -552,12 +581,17 @@ def _delete_initial( 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) - 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]: @@ -567,11 +601,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -601,7 +635,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -614,6 +649,7 @@ 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 ) @@ -634,10 +670,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get( @@ -659,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) @@ -672,6 +707,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -679,13 +716,18 @@ def get( 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) - 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]: @@ -699,7 +741,7 @@ def get( 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 @@ -719,7 +761,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -728,6 +770,8 @@ def list( ~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 @@ -741,6 +785,7 @@ def prepare_request(next_link=None): 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'], ) @@ -754,6 +799,7 @@ def prepare_request(next_link=None): 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, ) @@ -772,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]: @@ -785,4 +835,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vms_operations.py index 903976976e7f..a80f560dc584 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,11 +39,11 @@ def build_reimage_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage') + _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'), @@ -51,22 +51,22 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,9 +80,10 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -90,16 +91,16 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -111,9 +112,10 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -121,16 +123,16 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -145,12 +147,12 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}') + _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'), @@ -158,23 +160,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -190,9 +192,10 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -200,18 +203,18 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -225,10 +228,11 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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'), @@ -236,23 +240,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -264,10 +268,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -275,21 +280,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -304,37 +309,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -348,9 +354,10 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -358,18 +365,18 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -381,9 +388,10 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -391,16 +399,16 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -412,9 +420,10 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -422,16 +431,16 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -443,9 +452,10 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -453,16 +463,16 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -476,10 +486,11 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -487,23 +498,23 @@ def build_retrieve_boot_diagnostics_data_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -515,9 +526,10 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -525,16 +537,16 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -546,9 +558,10 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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'), @@ -556,16 +569,16 @@ def build_simulate_eviction_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -580,12 +593,12 @@ def build_run_command_request_initial( 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] - api_version = "2021-07-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -593,29 +606,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -637,7 +650,7 @@ 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: str, vm_scale_set_name: str, @@ -651,6 +664,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -663,6 +677,7 @@ def _reimage_initial( 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'], @@ -670,7 +685,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -680,11 +699,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -701,6 +720,7 @@ 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. + 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 @@ -715,8 +735,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -729,6 +750,7 @@ 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 @@ -750,12 +772,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -768,18 +789,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -789,11 +817,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -821,7 +849,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -833,6 +862,7 @@ 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 ) @@ -853,12 +883,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -871,18 +900,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -892,11 +928,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -925,7 +961,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -937,6 +974,7 @@ 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 ) @@ -957,10 +995,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -976,6 +1013,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -985,6 +1023,7 @@ def _update_initial( 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'], @@ -992,7 +1031,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1010,7 +1053,7 @@ def _update_initial( 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 @@ -1047,8 +1090,9 @@ def begin_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -1061,6 +1105,7 @@ 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 @@ -1085,12 +1130,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1104,19 +1148,26 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -1126,11 +1177,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1147,7 +1198,7 @@ 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. @@ -1161,7 +1212,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -1174,6 +1226,7 @@ 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 ) @@ -1194,10 +1247,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1218,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) @@ -1231,19 +1283,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -1257,7 +1316,7 @@ def get( 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 @@ -1287,18 +1346,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -1312,7 +1378,7 @@ def get_instance_view( 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 @@ -1333,12 +1399,13 @@ 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 @@ -1347,6 +1414,8 @@ def list( ~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 @@ -1359,6 +1428,7 @@ def prepare_request(next_link=None): 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, @@ -1373,6 +1443,7 @@ def prepare_request(next_link=None): 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, @@ -1393,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]: @@ -1406,9 +1481,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1422,19 +1497,26 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -1444,11 +1526,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1468,7 +1550,7 @@ 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. @@ -1482,7 +1564,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -1495,6 +1578,7 @@ 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 ) @@ -1515,12 +1599,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1533,18 +1616,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1554,11 +1644,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1585,7 +1675,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -1597,6 +1688,7 @@ 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 ) @@ -1617,12 +1709,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1635,18 +1726,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1656,11 +1754,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1687,7 +1785,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -1699,6 +1798,7 @@ 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 ) @@ -1719,12 +1819,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1737,18 +1836,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1758,11 +1864,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1790,7 +1896,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -1802,6 +1909,7 @@ 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 ) @@ -1822,10 +1930,9 @@ 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) + 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 + 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( @@ -1847,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) @@ -1860,19 +1967,26 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + 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) - 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]: @@ -1886,10 +2000,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1902,18 +2016,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1923,11 +2044,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1954,7 +2075,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -1966,6 +2088,7 @@ 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 ) @@ -1986,13 +2109,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2018,18 +2140,25 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -2039,7 +2168,7 @@ 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( @@ -2048,6 +2177,8 @@ 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"]] @@ -2056,7 +2187,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2065,6 +2196,7 @@ def _run_command_initial( 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'], @@ -2072,7 +2204,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2088,7 +2224,7 @@ def _run_command_initial( 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 @@ -2098,6 +2234,8 @@ def begin_run_command( 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. @@ -2110,6 +2248,9 @@ 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 @@ -2123,8 +2264,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -2138,6 +2279,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2161,7 +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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_sets_operations.py index 823109fc2212..9db71faee863 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_scale_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -158,27 +159,28 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -191,33 +193,34 @@ def build_get_request( expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -231,33 +234,33 @@ def build_deallocate_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -274,35 +277,35 @@ def build_delete_instances_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -315,31 +318,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -349,30 +353,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -381,29 +386,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -414,31 +420,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -449,31 +456,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -488,35 +496,35 @@ def build_power_off_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -532,33 +540,33 @@ def build_restart_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -574,33 +582,33 @@ def build_start_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -616,33 +624,33 @@ def build_redeploy_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -658,33 +666,33 @@ def build_perform_maintenance_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -700,33 +708,33 @@ def build_update_instances_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -742,33 +750,33 @@ def build_reimage_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -784,33 +792,33 @@ def build_reimage_all_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -825,32 +833,33 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( platform_update_domain: int, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -864,33 +873,33 @@ def build_convert_to_single_placement_group_request( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -906,39 +915,39 @@ def build_set_orchestration_service_state_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -977,6 +986,8 @@ def list_by_location( ~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 @@ -988,6 +999,7 @@ def prepare_request(next_link=None): 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) @@ -998,6 +1010,7 @@ def prepare_request(next_link=None): 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) @@ -1015,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]: @@ -1028,7 +1045,7 @@ def get_next(next_link=None): 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, @@ -1043,6 +1060,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -1051,6 +1069,7 @@ def _create_or_update_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'], @@ -1058,7 +1077,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1076,7 +1099,7 @@ def _create_or_update_initial( 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 @@ -1109,8 +1132,9 @@ def begin_create_or_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1122,6 +1146,7 @@ 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 @@ -1146,10 +1171,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -1164,6 +1188,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -1172,6 +1197,7 @@ def _update_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'], @@ -1179,7 +1205,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1193,7 +1223,7 @@ def _update_initial( 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 @@ -1226,8 +1256,9 @@ def begin_update( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1239,6 +1270,7 @@ 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 @@ -1263,12 +1295,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1281,18 +1312,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -1302,11 +1340,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1320,6 +1358,7 @@ 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. @@ -1333,7 +1372,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -1345,6 +1385,7 @@ 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 ) @@ -1365,10 +1406,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1386,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) @@ -1399,18 +1439,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -1424,10 +1471,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1440,6 +1487,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1451,6 +1499,7 @@ def _deallocate_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'], @@ -1458,7 +1507,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1468,11 +1521,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1487,7 +1540,8 @@ 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. + :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 @@ -1502,8 +1556,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1515,6 +1570,7 @@ 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 @@ -1536,12 +1592,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1555,6 +1610,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -1563,6 +1619,7 @@ def _delete_instances_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, @@ -1571,7 +1628,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1581,11 +1642,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1603,7 +1664,7 @@ def begin_delete_instances( :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. @@ -1617,8 +1678,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1631,6 +1693,7 @@ 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 @@ -1652,10 +1715,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1681,17 +1743,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -1705,7 +1774,7 @@ def get_instance_view( 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 @@ -1725,6 +1794,8 @@ def list( ~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 @@ -1736,6 +1807,7 @@ def prepare_request(next_link=None): 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) @@ -1746,6 +1818,7 @@ def prepare_request(next_link=None): 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) @@ -1763,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]: @@ -1776,7 +1853,7 @@ def get_next(next_link=None): 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( @@ -1794,6 +1871,8 @@ def list_all( ~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 @@ -1804,6 +1883,7 @@ def prepare_request(next_link=None): 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) @@ -1813,6 +1893,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1830,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]: @@ -1843,7 +1928,7 @@ def get_next(next_link=None): 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( @@ -1866,6 +1951,8 @@ def list_skus( ~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 @@ -1878,6 +1965,7 @@ def prepare_request(next_link=None): 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) @@ -1889,6 +1977,7 @@ def prepare_request(next_link=None): 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) @@ -1906,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]: @@ -1919,7 +2012,7 @@ def get_next(next_link=None): 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( @@ -1941,6 +2034,8 @@ def get_os_upgrade_history( ~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 @@ -1953,6 +2048,7 @@ def prepare_request(next_link=None): 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) @@ -1964,6 +2060,7 @@ def prepare_request(next_link=None): 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) @@ -1981,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]: @@ -1994,9 +2095,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -2010,6 +2111,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2021,6 +2123,7 @@ def _power_off_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, @@ -2029,7 +2132,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2039,11 +2146,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2061,9 +2168,10 @@ 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. + :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 @@ -2078,8 +2186,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2092,6 +2201,7 @@ 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 @@ -2113,12 +2223,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2131,6 +2240,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2142,6 +2252,7 @@ def _restart_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'], @@ -2149,7 +2260,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2159,11 +2274,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2176,7 +2291,8 @@ 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. + :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 @@ -2191,8 +2307,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2204,6 +2321,7 @@ 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 @@ -2225,12 +2343,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2243,6 +2360,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2254,6 +2372,7 @@ def _start_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'], @@ -2261,7 +2380,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2271,11 +2394,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2288,7 +2411,8 @@ 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. + :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 @@ -2303,8 +2427,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2316,6 +2441,7 @@ 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 @@ -2337,12 +2463,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2355,6 +2480,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2366,6 +2492,7 @@ def _redeploy_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'], @@ -2373,7 +2500,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2383,11 +2514,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2401,7 +2532,8 @@ 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. + :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 @@ -2416,8 +2548,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2429,6 +2562,7 @@ 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 @@ -2450,12 +2584,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2468,6 +2601,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2479,6 +2613,7 @@ def _perform_maintenance_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'], @@ -2486,7 +2621,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2496,11 +2635,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2516,7 +2655,8 @@ 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. + :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 @@ -2531,8 +2671,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2544,6 +2685,7 @@ 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 @@ -2565,12 +2707,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2583,6 +2724,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -2591,6 +2733,7 @@ def _update_instances_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'], @@ -2598,7 +2741,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2608,11 +2755,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2640,8 +2787,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2653,6 +2801,7 @@ 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 @@ -2674,12 +2823,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2692,6 +2840,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -2703,6 +2852,7 @@ def _reimage_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'], @@ -2710,7 +2860,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2720,11 +2874,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2739,7 +2893,7 @@ 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. + :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 @@ -2754,8 +2908,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2767,6 +2922,7 @@ 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 @@ -2788,12 +2944,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2806,6 +2961,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2817,6 +2973,7 @@ def _reimage_all_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'], @@ -2824,7 +2981,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2834,11 +2995,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2852,7 +3013,8 @@ 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. + :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 @@ -2867,8 +3029,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2880,6 +3043,7 @@ 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 @@ -2901,10 +3065,9 @@ 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) + 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 + 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( @@ -2935,18 +3098,25 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -2960,11 +3130,11 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2991,6 +3161,7 @@ def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + 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, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2999,6 +3170,7 @@ def convert_to_single_placement_group( 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'], @@ -3006,7 +3178,11 @@ def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3016,10 +3192,10 @@ 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: str, vm_scale_set_name: str, @@ -3032,6 +3208,7 @@ def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -3040,6 +3217,7 @@ def _set_orchestration_service_state_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'], @@ -3047,7 +3225,11 @@ def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3057,11 +3239,11 @@ 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 @distributed_trace - def begin_set_orchestration_service_state( + def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -3088,8 +3270,9 @@ def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -3101,6 +3284,7 @@ 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 @@ -3122,7 +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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_sizes_operations.py index 44f2c1093e50..6439a7c0951e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machine_sizes_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,6 +99,8 @@ def list( ~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 @@ -109,6 +112,7 @@ def prepare_request(next_link=None): 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) @@ -119,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machines_operations.py index 53d815d1ae9f..6afeba789405 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -202,27 +203,28 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -235,33 +237,34 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -272,31 +275,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -307,25 +311,26 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -338,27 +343,28 @@ def build_deallocate_request_initial( hibernate: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -369,25 +375,26 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -397,30 +404,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -431,31 +439,32 @@ def build_list_all_request( status_only: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -466,31 +475,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -503,27 +513,28 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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, + url=_url, + params=_query_parameters, **kwargs ) @@ -534,31 +545,32 @@ def build_reapply_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -569,25 +581,26 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -598,25 +611,26 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -627,25 +641,26 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -659,33 +674,33 @@ def build_reimage_request_initial( 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] - api_version = "2021-07-01" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -700,33 +715,34 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -737,25 +753,26 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -766,25 +783,26 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -795,31 +813,32 @@ def build_assess_patches_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-07-01" + 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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -833,35 +852,35 @@ def build_install_patches_request_initial( 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] - api_version = "2021-07-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -877,41 +896,41 @@ def build_run_command_request_initial( 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] - api_version = "2021-07-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -950,6 +969,8 @@ def list_by_location( ~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 @@ -961,6 +982,7 @@ def prepare_request(next_link=None): 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) @@ -971,6 +993,7 @@ def prepare_request(next_link=None): 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) @@ -988,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]: @@ -1001,7 +1028,7 @@ def get_next(next_link=None): 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, @@ -1016,6 +1043,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -1024,6 +1052,7 @@ def _capture_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'], @@ -1031,7 +1060,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1047,7 +1080,7 @@ def _capture_initial( 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 @@ -1081,8 +1114,9 @@ def begin_capture( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1094,6 +1128,7 @@ 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 @@ -1118,10 +1153,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -1136,6 +1170,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -1144,6 +1179,7 @@ def _create_or_update_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'], @@ -1151,7 +1187,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1169,7 +1209,7 @@ def _create_or_update_initial( 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 @@ -1202,8 +1242,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1215,6 +1256,7 @@ 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 @@ -1239,10 +1281,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1257,6 +1298,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -1265,6 +1307,7 @@ def _update_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'], @@ -1272,7 +1315,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1286,7 +1333,7 @@ def _update_initial( 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 @@ -1318,8 +1365,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1331,6 +1379,7 @@ 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 @@ -1355,12 +1404,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1373,18 +1421,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -1394,11 +1449,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1411,7 +1466,8 @@ 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. @@ -1425,7 +1481,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -1437,6 +1494,7 @@ 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 ) @@ -1457,10 +1515,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1480,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) @@ -1492,18 +1550,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + 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, 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) - 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]: @@ -1517,7 +1582,7 @@ def get( 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 @@ -1544,17 +1609,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -1568,10 +1640,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1583,17 +1655,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1603,11 +1682,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1632,7 +1711,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -1643,6 +1723,7 @@ 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 ) @@ -1663,12 +1744,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1681,18 +1761,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -1702,11 +1789,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1721,6 +1808,7 @@ 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. @@ -1734,7 +1822,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -1746,6 +1835,7 @@ 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 ) @@ -1766,13 +1856,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1800,17 +1889,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -1820,7 +1916,7 @@ 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 @@ -1841,6 +1937,8 @@ def list( ~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 @@ -1852,6 +1950,7 @@ def prepare_request(next_link=None): 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) @@ -1862,6 +1961,7 @@ def prepare_request(next_link=None): 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) @@ -1879,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]: @@ -1892,7 +1996,7 @@ def get_next(next_link=None): 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( @@ -1904,7 +2008,7 @@ 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 @@ -1913,6 +2017,8 @@ def list_all( ~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 @@ -1923,6 +2029,7 @@ def prepare_request(next_link=None): 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'], ) @@ -1933,6 +2040,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, template_url=next_link, ) @@ -1951,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]: @@ -1964,7 +2076,7 @@ def get_next(next_link=None): 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( @@ -1987,6 +2099,8 @@ def list_available_sizes( ~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 @@ -1999,6 +2113,7 @@ def prepare_request(next_link=None): 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) @@ -2010,6 +2125,7 @@ def prepare_request(next_link=None): 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) @@ -2027,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]: @@ -2040,9 +2160,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -2055,18 +2175,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -2076,11 +2203,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2096,7 +2223,7 @@ 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. @@ -2110,7 +2237,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -2122,6 +2250,7 @@ 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 ) @@ -2142,12 +2271,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2159,17 +2287,24 @@ def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -2179,11 +2314,11 @@ 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 @distributed_trace - def begin_reapply( + def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2207,7 +2342,8 @@ def begin_reapply( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -2218,6 +2354,7 @@ 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 ) @@ -2238,12 +2375,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2255,17 +2391,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -2275,11 +2418,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2303,7 +2446,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -2314,6 +2458,7 @@ 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 ) @@ -2334,12 +2479,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2351,17 +2495,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -2371,11 +2522,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2399,7 +2550,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -2410,6 +2562,7 @@ 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 ) @@ -2430,12 +2583,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2447,17 +2599,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -2467,11 +2626,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2495,7 +2654,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -2506,6 +2666,7 @@ 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 ) @@ -2526,12 +2687,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2544,6 +2704,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -2555,6 +2716,7 @@ def _reimage_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'], @@ -2562,7 +2724,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2572,11 +2738,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2589,7 +2755,8 @@ 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. @@ -2603,8 +2770,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2616,6 +2784,7 @@ 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 @@ -2637,10 +2806,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore @distributed_trace def retrieve_boot_diagnostics_data( @@ -2658,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) @@ -2671,18 +2839,25 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + 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_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) - 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]: @@ -2696,10 +2871,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2711,17 +2886,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -2731,11 +2913,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2759,7 +2941,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -2770,6 +2953,7 @@ 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 ) @@ -2790,13 +2974,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2819,17 +3002,24 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: str + 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) - 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]: @@ -2839,7 +3029,7 @@ 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( @@ -2854,17 +3044,24 @@ def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-07-01") # type: 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) - 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]: @@ -2880,7 +3077,7 @@ def _assess_patches_initial( 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 @@ -2910,7 +3107,8 @@ def begin_assess_patches( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -2921,6 +3119,7 @@ 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 ) @@ -2944,10 +3143,9 @@ 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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore def _install_patches_initial( self, @@ -2962,6 +3160,7 @@ def _install_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + 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') @@ -2970,6 +3169,7 @@ def _install_patches_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'], @@ -2977,7 +3177,11 @@ def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2993,7 +3197,7 @@ def _install_patches_initial( 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 @@ -3027,8 +3231,9 @@ def begin_install_patches( ~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, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -3040,6 +3245,7 @@ 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 @@ -3064,16 +3270,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) + 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 + 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: 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"]] @@ -3082,7 +3289,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-07-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -3090,6 +3297,7 @@ def _run_command_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'], @@ -3097,7 +3305,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3113,7 +3325,7 @@ def _run_command_initial( 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 @@ -3122,6 +3334,8 @@ def begin_run_command( 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. @@ -3132,6 +3346,9 @@ 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 @@ -3145,8 +3362,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_07_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + 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( 'polling_interval', @@ -3159,6 +3376,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -3182,7 +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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_compute_management_client.py index 76bb0b85b41a..4ce4ebbb696a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -41,8 +42,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-08-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. """ @@ -70,7 +74,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_configuration.py index 5145444f73ec..a34f1c1e8748 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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-08-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-08-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_metadata.json index 4e15c5b50371..f654d4fa1840 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_compute_management_client.py index 77438d0120ac..52f9bb063cef 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -41,8 +42,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-08-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_configuration.py index e8b50952ba51..7a31141e90e2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/_configuration.py @@ -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-08-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-08-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_accesses_operations.py index 64a061b76c9c..f692e6cf64d6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace_async async def get_private_link_resources( @@ -602,17 +646,24 @@ async def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -626,7 +677,7 @@ async def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore async def _update_a_private_endpoint_connection_initial( @@ -643,6 +694,7 @@ async def _update_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -652,6 +704,7 @@ async def _update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], @@ -659,7 +712,11 @@ async def _update_a_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -677,7 +734,7 @@ async def _update_a_private_endpoint_connection_initial( return deserialized - _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -718,8 +775,9 @@ async def begin_update_a_private_endpoint_connection( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -732,6 +790,7 @@ async def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -756,10 +815,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_update_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async async def get_a_private_endpoint_connection( @@ -790,18 +848,25 @@ async def get_a_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_a_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_a_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -815,10 +880,10 @@ async def get_a_private_endpoint_connection( return deserialized - get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - async def _delete_a_private_endpoint_connection_initial( + async def _delete_a_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -831,18 +896,25 @@ async def _delete_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_delete_a_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -852,11 +924,11 @@ async def _delete_a_private_endpoint_connection_initial( if cls: return cls(pipeline_response, None, {}) - _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete_a_private_endpoint_connection( + async def begin_delete_a_private_endpoint_connection( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -885,7 +957,8 @@ async def begin_delete_a_private_endpoint_connection( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -897,6 +970,7 @@ async def begin_delete_a_private_endpoint_connection( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -917,10 +991,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_private_endpoint_connections( @@ -944,6 +1017,8 @@ def list_private_endpoint_connections( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -956,6 +1031,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) @@ -967,6 +1043,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -984,7 +1061,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]: @@ -997,4 +1078,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_encryption_sets_operations.py index c516145cad1f..e60958a6bd81 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -130,8 +135,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -167,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -193,6 +200,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,7 +230,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -254,8 +266,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,6 +280,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -291,10 +305,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async async def get( @@ -322,17 +335,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -346,10 +366,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -361,17 +381,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -381,11 +408,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -411,7 +438,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -422,6 +450,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -442,10 +471,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -464,6 +492,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -475,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -485,6 +516,7 @@ def prepare_request(next_link=None): 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) @@ -502,7 +534,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]: @@ -515,7 +551,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -531,6 +567,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -541,6 +579,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -550,6 +589,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -567,7 +607,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]: @@ -580,7 +624,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -603,6 +647,8 @@ def list_associated_resources( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -615,6 +661,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -626,6 +673,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -643,7 +691,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]: @@ -656,4 +708,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_restore_point_operations.py index f413b06e9a0a..d30854fcd974 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disk_restore_point_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -80,6 +79,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -87,12 +88,17 @@ async def get( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_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) - 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]: @@ -106,7 +112,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}"} # type: ignore @distributed_trace @@ -134,6 +140,8 @@ def list_by_restore_point( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -147,6 +155,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=self.list_by_restore_point.metadata['url'], ) request = _convert_request(request) @@ -159,6 +168,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -176,7 +186,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]: @@ -189,7 +203,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + list_by_restore_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints"} # type: ignore async def _grant_access_initial( self, @@ -206,6 +220,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -216,6 +231,7 @@ async def _grant_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -223,7 +239,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -239,7 +259,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -280,8 +300,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,6 +316,7 @@ async def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -319,12 +341,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -338,6 +359,8 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, @@ -345,12 +368,17 @@ async def _revoke_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -360,11 +388,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -396,7 +424,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -409,6 +438,7 @@ async def begin_revoke_access( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -429,7 +459,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disks_operations.py index a853314f5192..6b6c7691865f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_snapshots_operations.py index 51e77ee74861..8c0a371f965b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_08_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_accesses_operations.py index fcf41e8c5e5c..52033d5ad6eb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_get_private_link_resources_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -296,12 +301,12 @@ def build_update_a_private_endpoint_connection_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -309,23 +314,23 @@ def build_update_a_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -339,10 +344,11 @@ def build_get_a_private_endpoint_connection_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -350,21 +356,21 @@ def build_get_a_private_endpoint_connection_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -376,10 +382,11 @@ def build_delete_a_private_endpoint_connection_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -387,21 +394,21 @@ def build_delete_a_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -412,31 +419,32 @@ def build_list_private_endpoint_connections_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -475,6 +483,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -483,6 +492,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -490,7 +500,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -508,7 +522,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -541,8 +555,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -554,6 +569,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -578,10 +594,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore def _update_initial( self, @@ -596,6 +611,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -604,6 +620,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -611,7 +628,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -629,7 +650,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -662,8 +683,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -675,6 +697,7 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -699,10 +722,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def get( @@ -730,17 +752,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -754,10 +783,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -769,17 +798,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -789,11 +825,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -819,7 +855,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -830,6 +867,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -850,10 +888,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -870,6 +907,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -881,6 +920,7 @@ def prepare_request(next_link=None): 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) @@ -891,6 +931,7 @@ def prepare_request(next_link=None): 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) @@ -908,7 +949,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]: @@ -921,7 +966,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -935,6 +980,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -945,6 +992,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -954,6 +1002,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -971,7 +1020,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]: @@ -984,7 +1037,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def get_private_link_resources( @@ -1012,17 +1065,24 @@ def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1036,7 +1096,7 @@ def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore def _update_a_private_endpoint_connection_initial( @@ -1053,6 +1113,7 @@ def _update_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -1062,6 +1123,7 @@ def _update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], @@ -1069,7 +1131,11 @@ def _update_a_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1087,7 +1153,7 @@ def _update_a_private_endpoint_connection_initial( return deserialized - _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace @@ -1128,8 +1194,9 @@ def begin_update_a_private_endpoint_connection( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -1142,6 +1209,7 @@ def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1166,10 +1234,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_update_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def get_a_private_endpoint_connection( @@ -1200,18 +1267,25 @@ def get_a_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_a_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_a_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1225,10 +1299,10 @@ def get_a_private_endpoint_connection( return deserialized - get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - def _delete_a_private_endpoint_connection_initial( + def _delete_a_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -1241,18 +1315,25 @@ def _delete_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_delete_a_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1262,11 +1343,11 @@ def _delete_a_private_endpoint_connection_initial( if cls: return cls(pipeline_response, None, {}) - _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete_a_private_endpoint_connection( + def begin_delete_a_private_endpoint_connection( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -1295,7 +1376,8 @@ def begin_delete_a_private_endpoint_connection( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,6 +1389,7 @@ def begin_delete_a_private_endpoint_connection( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1327,10 +1410,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_private_endpoint_connections( @@ -1354,6 +1436,8 @@ def list_private_endpoint_connections( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1366,6 +1450,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) @@ -1377,6 +1462,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1394,7 +1480,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]: @@ -1407,4 +1497,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_encryption_sets_operations.py index 370a0fcaaf96..ca1310917fe3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_list_associated_resources_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -320,6 +325,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -328,6 +334,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -335,7 +342,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -353,7 +364,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -388,8 +399,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -401,6 +413,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -425,10 +438,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore def _update_initial( self, @@ -443,6 +455,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -451,6 +464,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -458,7 +472,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -476,7 +494,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -511,8 +529,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -524,6 +543,7 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -548,10 +568,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def get( @@ -579,17 +598,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -603,10 +629,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -618,17 +644,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -638,11 +671,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -668,7 +701,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -679,6 +713,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -699,10 +734,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -721,6 +755,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -732,6 +768,7 @@ def prepare_request(next_link=None): 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) @@ -742,6 +779,7 @@ def prepare_request(next_link=None): 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) @@ -759,7 +797,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]: @@ -772,7 +814,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -788,6 +830,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -798,6 +842,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -807,6 +852,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -824,7 +870,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]: @@ -837,7 +887,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -859,6 +909,8 @@ def list_associated_resources( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -871,6 +923,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -882,6 +935,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -899,7 +953,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]: @@ -912,4 +970,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_restore_point_operations.py index a11c1288a624..febef73d8905 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disk_restore_point_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( disk_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}") # 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'), @@ -49,21 +50,21 @@ def build_get_request( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -75,10 +76,11 @@ def build_list_by_restore_point_request( vm_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints") # 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'), @@ -86,21 +88,21 @@ def build_list_by_restore_point_request( "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -116,12 +118,12 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess") # 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'), @@ -130,23 +132,23 @@ def build_grant_access_request_initial( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -161,10 +163,11 @@ def build_revoke_access_request_initial( disk_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess") # 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'), @@ -173,21 +176,21 @@ def build_revoke_access_request_initial( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -245,6 +248,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -252,12 +257,17 @@ def get( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_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) - 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]: @@ -271,7 +281,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}"} # type: ignore @distributed_trace @@ -299,6 +309,8 @@ def list_by_restore_point( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -312,6 +324,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=self.list_by_restore_point.metadata['url'], ) request = _convert_request(request) @@ -324,6 +337,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -341,7 +355,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]: @@ -354,7 +372,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + list_by_restore_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints"} # type: ignore def _grant_access_initial( self, @@ -371,6 +389,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -381,6 +400,7 @@ def _grant_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -388,7 +408,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -404,7 +428,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore @distributed_trace @@ -444,8 +468,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -459,6 +484,7 @@ def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -483,12 +509,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -502,6 +527,8 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, @@ -509,12 +536,17 @@ def _revoke_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -524,11 +556,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -560,7 +592,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -573,6 +606,7 @@ def begin_revoke_access( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -593,7 +627,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disks_operations.py index 703fb6fea3a0..9e7a8a1f5839 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_snapshots_operations.py index 7197b9fe2f40..b877038d2e2d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_08_01/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-08-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-08-01" + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_08_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_08_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-08-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-08-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_compute_management_client.py index d475ca762806..4da7a2d20344 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -45,8 +46,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -75,7 +79,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_configuration.py index c0c7d20d820c..2f0492cbd0d7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-10-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_metadata.json index c224fbb0eaee..9bc5458324cb 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_compute_management_client.py index d6e277ccd944..60675c5a4926 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -45,8 +46,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_configuration.py index eee29f2e1345..18fd707a839c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/_configuration.py @@ -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-10-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-10-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_galleries_operations.py index ae4604094203..ec08c6fdc30e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -97,7 +102,7 @@ async def _create_or_update_initial( 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 @@ -130,8 +135,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_10_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ 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 @@ -167,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'GalleryUpdate') @@ -193,6 +200,7 @@ async def _update_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'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -214,7 +226,7 @@ async def _update_initial( 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 @@ -247,8 +259,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_10_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -260,6 +273,7 @@ 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 @@ -284,10 +298,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace_async async def get( @@ -304,9 +317,9 @@ 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_10_01.models.SelectPermissions - :param expand: The expand query option to apply on the operation. + :param expand: The expand query option to apply on the operation. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_10_01.models.GalleryExpandParams :keyword callable cls: A custom type or function that will be passed the direct response :return: Gallery, or the result of cls(response) @@ -319,11 +332,14 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: 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, expand=expand, template_url=self.get.metadata['url'], @@ -331,7 +347,11 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -345,10 +365,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -360,17 +380,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: 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) - 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]: @@ -380,11 +407,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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -408,7 +435,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -419,6 +447,7 @@ 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 ) @@ -439,10 +468,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -460,6 +488,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -471,6 +501,7 @@ def prepare_request(next_link=None): 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) @@ -481,6 +512,7 @@ def prepare_request(next_link=None): 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) @@ -498,7 +530,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]: @@ -511,7 +547,7 @@ async def get_next(next_link=None): 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( @@ -526,6 +562,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -536,6 +574,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -545,6 +584,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -562,7 +602,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]: @@ -575,4 +619,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_application_versions_operations.py index c148140601b9..142985fe8fb1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -147,8 +152,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -162,6 +168,7 @@ 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 @@ -186,10 +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) + 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 + 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, @@ -206,6 +212,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') @@ -216,6 +223,7 @@ async def _update_initial( 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'], @@ -223,7 +231,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -237,7 +249,7 @@ async def _update_initial( 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 @@ -283,8 +295,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -298,6 +311,7 @@ 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 @@ -322,10 +336,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) + 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 + 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( @@ -350,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_10_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) @@ -363,6 +376,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -370,13 +385,18 @@ async def get( 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) - 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]: @@ -390,10 +410,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -407,6 +427,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -414,12 +436,17 @@ async def _delete_initial( 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) - 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]: @@ -429,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -466,7 +493,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +507,7 @@ 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 ) @@ -499,10 +528,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) + 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 + 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( @@ -529,6 +557,8 @@ def list_by_gallery_application( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -542,6 +572,7 @@ def prepare_request(next_link=None): 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) @@ -554,6 +585,7 @@ def prepare_request(next_link=None): 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) @@ -571,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]: @@ -584,4 +620,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_applications_operations.py index 2727c1a0dc3b..209945da7fe2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplication') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -139,8 +144,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -153,6 +159,7 @@ 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 @@ -177,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore async def _update_initial( self, @@ -196,6 +202,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') @@ -205,6 +212,7 @@ async def _update_initial( 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'], @@ -212,7 +220,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -265,8 +277,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,6 +292,7 @@ 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 @@ -303,10 +317,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace_async async def get( @@ -337,18 +350,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-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, + 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(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]: @@ -362,10 +382,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -378,18 +398,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -399,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -431,7 +458,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -443,6 +471,7 @@ 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 ) @@ -463,10 +492,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -489,6 +517,8 @@ def list_by_gallery( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -501,6 +531,7 @@ def prepare_request(next_link=None): 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) @@ -512,6 +543,7 @@ def prepare_request(next_link=None): 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) @@ -529,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]: @@ -542,4 +578,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_image_versions_operations.py index cde794bec67d..bb3785483190 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -63,6 +62,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -73,6 +73,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +81,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -101,7 +106,7 @@ async def _create_or_update_initial( 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 @@ -146,8 +151,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -161,6 +167,7 @@ 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 @@ -185,10 +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) + 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 + 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, @@ -205,6 +211,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') @@ -215,6 +222,7 @@ async def _update_initial( 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'], @@ -222,7 +230,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -236,7 +248,7 @@ async def _update_initial( 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 @@ -281,8 +293,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,6 +309,7 @@ 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 @@ -320,10 +334,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) + 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 + 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( @@ -347,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_10_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) @@ -360,6 +373,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -367,13 +382,18 @@ async def get( 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) - 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]: @@ -387,10 +407,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -404,6 +424,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -411,12 +433,17 @@ async def _delete_initial( 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) - 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]: @@ -426,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -462,7 +489,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -475,6 +503,7 @@ 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 ) @@ -495,10 +524,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) + 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 + 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( @@ -525,6 +553,8 @@ def list_by_gallery_image( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -538,6 +568,7 @@ def prepare_request(next_link=None): 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) @@ -550,6 +581,7 @@ def prepare_request(next_link=None): 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) @@ -567,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]: @@ -580,4 +616,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_images_operations.py index cf99aa6b749e..699400bdfc85 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -99,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -151,6 +157,7 @@ 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 @@ -175,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore async def _update_initial( self, @@ -194,6 +200,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') @@ -203,6 +210,7 @@ async def _update_initial( 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'], @@ -210,7 +218,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -224,7 +236,7 @@ async def _update_initial( 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 @@ -262,8 +274,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,6 +289,7 @@ 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 @@ -300,10 +314,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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace_async async def get( @@ -333,18 +346,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-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, + 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(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]: @@ -358,10 +378,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -374,18 +394,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -395,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -427,7 +454,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -439,6 +467,7 @@ 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 ) @@ -459,10 +488,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -484,6 +512,8 @@ def list_by_gallery( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -496,6 +526,7 @@ def prepare_request(next_link=None): 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) @@ -507,6 +538,7 @@ def prepare_request(next_link=None): 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) @@ -524,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]: @@ -537,4 +573,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_sharing_profile_operations.py index 9b1e9f96b60a..2801ba1c0e16 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/aio/operations/_gallery_sharing_profile_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -59,6 +58,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(sharing_update, 'SharingUpdate') @@ -67,6 +67,7 @@ async def _update_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'], @@ -74,7 +75,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -92,7 +97,7 @@ async def _update_initial( 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 @@ -125,8 +130,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_10_01.models.SharingUpdate] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,7 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_galleries_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_galleries_operations.py index 52ecba42f426..500d84ece9e4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_galleries_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_galleries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -126,35 +126,36 @@ def build_get_request( expand: Optional[Union[str, "_models.GalleryExpandParams"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,31 +166,32 @@ def build_delete_request_initial( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,30 +201,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -231,29 +234,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -292,6 +296,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'Gallery') @@ -300,6 +305,7 @@ def _create_or_update_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'], @@ -307,7 +313,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -328,7 +338,7 @@ def _create_or_update_initial( 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 @@ -360,8 +370,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_10_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -373,6 +384,7 @@ 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 @@ -397,10 +409,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore def _update_initial( self, @@ -415,6 +426,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery, 'GalleryUpdate') @@ -423,6 +435,7 @@ def _update_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'], @@ -430,7 +443,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -444,7 +461,7 @@ def _update_initial( 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 @@ -476,8 +493,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_10_01.models.Gallery] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Gallery"] lro_delay = kwargs.pop( 'polling_interval', @@ -489,6 +507,7 @@ 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 @@ -513,10 +532,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def get( @@ -533,9 +551,9 @@ 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_10_01.models.SelectPermissions - :param expand: The expand query option to apply on the operation. + :param expand: The expand query option to apply on the operation. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_10_01.models.GalleryExpandParams :keyword callable cls: A custom type or function that will be passed the direct response :return: Gallery, or the result of cls(response) @@ -548,11 +566,14 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: 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, expand=expand, template_url=self.get.metadata['url'], @@ -560,7 +581,11 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -574,10 +599,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -589,17 +614,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: 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) - 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]: @@ -609,11 +641,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -637,7 +669,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -648,6 +681,7 @@ 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 ) @@ -668,10 +702,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -688,6 +721,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -699,6 +734,7 @@ def prepare_request(next_link=None): 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) @@ -709,6 +745,7 @@ def prepare_request(next_link=None): 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) @@ -726,7 +763,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]: @@ -739,7 +780,7 @@ def get_next(next_link=None): 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( @@ -753,6 +794,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -763,6 +806,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -772,6 +816,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -789,7 +834,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]: @@ -802,4 +851,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_application_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_application_versions_operations.py index 2e6f158a7a32..5438a74a10e7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_application_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -135,10 +135,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-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}') + _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'), @@ -147,23 +148,23 @@ def build_get_request( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -176,10 +177,11 @@ def build_delete_request_initial( gallery_application_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-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}') + _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'), @@ -188,21 +190,21 @@ def build_delete_request_initial( "galleryApplicationVersionName": _SERIALIZER.url("gallery_application_version_name", gallery_application_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -214,10 +216,11 @@ def build_list_by_gallery_application_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-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') + _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'), @@ -225,21 +228,21 @@ def build_list_by_gallery_application_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -280,6 +283,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersion') @@ -290,6 +294,7 @@ def _create_or_update_initial( 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'], @@ -297,7 +302,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -364,8 +373,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -379,6 +389,7 @@ 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 @@ -403,10 +414,9 @@ 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) + 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 + 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, @@ -423,6 +433,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application_version, 'GalleryApplicationVersionUpdate') @@ -433,6 +444,7 @@ def _update_initial( 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'], @@ -440,7 +452,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -454,7 +470,7 @@ def _update_initial( 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 @@ -500,8 +516,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryApplicationVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -515,6 +532,7 @@ 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 @@ -539,10 +557,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore @distributed_trace def get( @@ -567,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_10_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) @@ -580,6 +597,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -587,13 +606,18 @@ def get( 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) - 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]: @@ -607,10 +631,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -624,6 +648,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -631,12 +657,17 @@ def _delete_initial( 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) - 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]: @@ -646,11 +677,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -683,7 +714,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -696,6 +728,7 @@ 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 ) @@ -716,10 +749,9 @@ 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) + 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 + 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( @@ -746,6 +778,8 @@ def list_by_gallery_application( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryApplicationVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -759,6 +793,7 @@ def prepare_request(next_link=None): 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) @@ -771,6 +806,7 @@ def prepare_request(next_link=None): 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) @@ -788,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]: @@ -801,4 +841,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_applications_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_applications_operations.py index 1b84a7f627f0..f0b5ae70279a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_applications_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_get_request( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -139,21 +140,21 @@ def build_get_request( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,10 +166,11 @@ def build_delete_request_initial( gallery_application_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}') + _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'), @@ -176,21 +178,21 @@ def build_delete_request_initial( "galleryApplicationName": _SERIALIZER.url("gallery_application_name", gallery_application_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -201,31 +203,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,6 +268,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplication') @@ -274,6 +278,7 @@ def _create_or_update_initial( 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'], @@ -281,7 +286,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -302,7 +311,7 @@ def _create_or_update_initial( 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 @@ -342,8 +351,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -356,6 +366,7 @@ 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 @@ -380,10 +391,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore def _update_initial( self, @@ -399,6 +409,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_application, 'GalleryApplicationUpdate') @@ -408,6 +419,7 @@ def _update_initial( 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'], @@ -415,7 +427,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -429,7 +445,7 @@ def _update_initial( 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 @@ -468,8 +484,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryApplication] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplication"] lro_delay = kwargs.pop( 'polling_interval', @@ -482,6 +499,7 @@ 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 @@ -506,10 +524,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def get( @@ -540,18 +557,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-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, + 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(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]: @@ -565,10 +589,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -581,18 +605,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -602,11 +633,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -634,7 +665,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -646,6 +678,7 @@ 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 ) @@ -666,10 +699,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -692,6 +724,8 @@ def list_by_gallery( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -704,6 +738,7 @@ def prepare_request(next_link=None): 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) @@ -715,6 +750,7 @@ def prepare_request(next_link=None): 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) @@ -732,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]: @@ -745,4 +785,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_image_versions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_image_versions_operations.py index a08294ce6349..522f76fc9f94 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_image_versions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -135,10 +135,11 @@ def build_get_request( expand: Optional[Union[str, "_models.ReplicationStatusTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-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}') + _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'), @@ -147,23 +148,23 @@ def build_get_request( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -176,10 +177,11 @@ def build_delete_request_initial( gallery_image_version_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-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}') + _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'), @@ -188,21 +190,21 @@ def build_delete_request_initial( "galleryImageVersionName": _SERIALIZER.url("gallery_image_version_name", gallery_image_version_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -214,10 +216,11 @@ def build_list_by_gallery_image_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-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') + _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'), @@ -225,21 +228,21 @@ def build_list_by_gallery_image_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -280,6 +283,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersion') @@ -290,6 +294,7 @@ def _create_or_update_initial( 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'], @@ -297,7 +302,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -363,8 +372,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -378,6 +388,7 @@ 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 @@ -402,10 +413,9 @@ 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) + 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 + 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, @@ -422,6 +432,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image_version, 'GalleryImageVersionUpdate') @@ -432,6 +443,7 @@ def _update_initial( 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'], @@ -439,7 +451,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -453,7 +469,7 @@ def _update_initial( 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 @@ -498,8 +514,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryImageVersion] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersion"] lro_delay = kwargs.pop( 'polling_interval', @@ -513,6 +530,7 @@ 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 @@ -537,10 +555,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore @distributed_trace def get( @@ -564,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_10_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) @@ -577,6 +594,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -584,13 +603,18 @@ def get( 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) - 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]: @@ -604,10 +628,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -621,6 +645,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -628,12 +654,17 @@ def _delete_initial( 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) - 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]: @@ -643,11 +674,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -679,7 +710,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -692,6 +724,7 @@ 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 ) @@ -712,10 +745,9 @@ 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) + 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 + 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( @@ -742,6 +774,8 @@ def list_by_gallery_image( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryImageVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageVersionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -755,6 +789,7 @@ def prepare_request(next_link=None): 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) @@ -767,6 +802,7 @@ def prepare_request(next_link=None): 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) @@ -784,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]: @@ -797,4 +837,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_images_operations.py index 0d88f3b53285..7bd17bf8322d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_get_request( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -139,21 +140,21 @@ def build_get_request( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -165,10 +166,11 @@ def build_delete_request_initial( gallery_image_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}') + _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'), @@ -176,21 +178,21 @@ def build_delete_request_initial( "galleryImageName": _SERIALIZER.url("gallery_image_name", gallery_image_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -201,31 +203,32 @@ def build_list_by_gallery_request( gallery_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -265,6 +268,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImage') @@ -274,6 +278,7 @@ def _create_or_update_initial( 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'], @@ -281,7 +286,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201, 202]: @@ -302,7 +311,7 @@ def _create_or_update_initial( 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 @@ -340,8 +349,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -354,6 +364,7 @@ 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 @@ -378,10 +389,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore def _update_initial( self, @@ -397,6 +407,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gallery_image, 'GalleryImageUpdate') @@ -406,6 +417,7 @@ def _update_initial( 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'], @@ -413,7 +425,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -427,7 +443,7 @@ def _update_initial( 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 @@ -465,8 +481,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_10_01.models.GalleryImage] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImage"] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +496,7 @@ 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 @@ -503,10 +521,9 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def get( @@ -536,18 +553,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-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, + 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(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]: @@ -561,10 +585,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -577,18 +601,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-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, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -598,11 +629,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, gallery_name: str, @@ -630,7 +661,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -642,6 +674,7 @@ 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 ) @@ -662,10 +695,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}"} # type: ignore @distributed_trace def list_by_gallery( @@ -686,6 +718,8 @@ def list_by_gallery( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_10_01.models.GalleryImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -698,6 +732,7 @@ def prepare_request(next_link=None): 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) @@ -709,6 +744,7 @@ def prepare_request(next_link=None): 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) @@ -726,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]: @@ -739,4 +779,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_sharing_profile_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_sharing_profile_operations.py index 860dac3a3dfa..2651656632c0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/operations/_gallery_sharing_profile_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_10_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,35 +37,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -106,6 +106,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(sharing_update, 'SharingUpdate') @@ -114,6 +115,7 @@ def _update_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'], @@ -121,7 +123,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -139,7 +145,7 @@ def _update_initial( 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 @@ -171,8 +177,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_10_01.models.SharingUpdate] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-10-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SharingUpdate"] lro_delay = kwargs.pop( 'polling_interval', @@ -184,6 +191,7 @@ 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 @@ -208,7 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_compute_management_client.py index 333ccf6da32b..eb54ebcfdfb8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -103,8 +104,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-11-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. """ @@ -153,7 +157,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_configuration.py index 464530c99737..96a81e94f5e6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-11-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_metadata.json index 4ee78ce4fc67..9d1da5ae8252 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/_compute_management_client.py index 1458eb71545f..3b9669865f72 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ComputeManagementClient: +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes """Compute Client. :ivar operations: Operations operations @@ -105,8 +106,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-11-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/_configuration.py index fd713c38c315..474d426cb06b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/_configuration.py @@ -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-11-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-11-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_availability_sets_operations.py index edc88b95087c..50f3c110139e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -102,7 +107,7 @@ async def create_or_update( 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 @@ -132,6 +137,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -140,6 +146,7 @@ async def update( 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'], @@ -147,7 +154,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -161,11 +172,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -188,17 +199,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -208,7 +226,7 @@ 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 @@ -235,17 +253,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -259,7 +284,7 @@ async def get( 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 @@ -271,7 +296,7 @@ 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 @@ -280,6 +305,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -290,6 +317,7 @@ def prepare_request(next_link=None): 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'], ) @@ -300,6 +328,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -318,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]: @@ -331,7 +364,7 @@ async def get_next(next_link=None): 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( @@ -350,6 +383,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -361,6 +396,7 @@ def prepare_request(next_link=None): 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) @@ -371,6 +407,7 @@ def prepare_request(next_link=None): 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) @@ -388,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]: @@ -401,7 +442,7 @@ async def get_next(next_link=None): 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( @@ -424,6 +465,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -436,6 +479,7 @@ def prepare_request(next_link=None): 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) @@ -447,6 +491,7 @@ def prepare_request(next_link=None): 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) @@ -464,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]: @@ -477,4 +526,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_capacity_reservation_groups_operations.py index 043d7f6e3527..3c0d79efd771 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationGroup') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -139,6 +144,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') @@ -147,6 +153,7 @@ async def update( 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'], @@ -154,7 +161,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -168,11 +179,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -198,17 +209,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -218,7 +236,7 @@ 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 @@ -238,7 +256,7 @@ 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. + platform and can change outside of control plane operations. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_11_01.models.CapacityReservationGroupInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response @@ -252,18 +270,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -277,7 +302,7 @@ async def get( 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 @@ -294,7 +319,7 @@ 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. + associated to capacity reservation group in the response. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_11_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response @@ -304,6 +329,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -315,6 +342,7 @@ def prepare_request(next_link=None): 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'], ) @@ -326,6 +354,7 @@ def prepare_request(next_link=None): 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, ) @@ -344,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]: @@ -357,7 +390,7 @@ async def get_next(next_link=None): 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( @@ -370,7 +403,7 @@ 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. + associated to capacity reservation group in the response. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_11_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response @@ -380,6 +413,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -390,6 +425,7 @@ def prepare_request(next_link=None): 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'], ) @@ -400,6 +436,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -418,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]: @@ -431,4 +472,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_capacity_reservations_operations.py index 89864e6a9fa8..236edabaed57 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservation') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -134,8 +139,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.CapacityReservation] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -148,6 +154,7 @@ 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 @@ -172,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore async def _update_initial( self, @@ -191,6 +197,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationUpdate') @@ -200,6 +207,7 @@ async def _update_initial( 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'], @@ -207,7 +215,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -223,7 +235,7 @@ async def _update_initial( 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 @@ -259,8 +271,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.CapacityReservation] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -273,6 +286,7 @@ 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 @@ -297,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -315,18 +328,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -336,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -369,7 +389,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -381,6 +402,7 @@ 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 ) @@ -401,10 +423,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore @distributed_trace_async async def get( @@ -425,7 +446,7 @@ 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. + and can change outside of control plane operations. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_11_01.models.CapacityReservationInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response @@ -439,19 +460,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -465,7 +493,7 @@ async def get( 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 @@ -489,6 +517,8 @@ def list_by_capacity_reservation_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.CapacityReservationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -501,6 +531,7 @@ def prepare_request(next_link=None): 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) @@ -512,6 +543,7 @@ def prepare_request(next_link=None): 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) @@ -529,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]: @@ -542,4 +578,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_dedicated_host_groups_operations.py index 41e31460327c..09ab190bcd21 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -75,6 +74,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -83,6 +83,7 @@ async def create_or_update( 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'], @@ -90,7 +91,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -108,7 +113,7 @@ async def create_or_update( 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 @@ -138,6 +143,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -146,6 +152,7 @@ async def update( 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'], @@ -153,7 +160,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -167,11 +178,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -194,17 +205,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -214,7 +232,7 @@ 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 @@ -233,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_11_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) @@ -246,18 +264,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -271,7 +296,7 @@ async def get( 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 @@ -292,6 +317,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -303,6 +330,7 @@ def prepare_request(next_link=None): 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) @@ -313,6 +341,7 @@ def prepare_request(next_link=None): 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) @@ -330,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]: @@ -343,7 +376,7 @@ async def get_next(next_link=None): 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( @@ -360,6 +393,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -370,6 +405,7 @@ def prepare_request(next_link=None): 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) @@ -379,6 +415,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -396,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]: @@ -409,4 +450,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_dedicated_hosts_operations.py index 8074b3ab583d..d5d806c2013f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -255,8 +267,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -269,6 +282,7 @@ 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 @@ -293,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -311,18 +324,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -332,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -363,7 +383,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -375,6 +396,7 @@ 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 ) @@ -395,10 +417,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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_11_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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -482,6 +510,8 @@ def list_by_host_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -494,6 +524,7 @@ def prepare_request(next_link=None): 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) @@ -505,6 +536,7 @@ def prepare_request(next_link=None): 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) @@ -522,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]: @@ -535,9 +571,9 @@ async def get_next(next_link=None): 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 - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -550,18 +586,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_restart_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._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -571,11 +614,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart"} # type: ignore @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -606,7 +649,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -618,6 +662,7 @@ async def begin_restart( 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 ) @@ -638,7 +683,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_images_operations.py index 6e26dadf3685..d43a90985e0a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -69,6 +69,7 @@ async def _create_or_update_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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -125,8 +130,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,6 +144,7 @@ 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 @@ -162,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore async def _update_initial( self, @@ -180,6 +186,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -188,6 +195,7 @@ async def _update_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'], @@ -195,7 +203,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -213,7 +225,7 @@ async def _update_initial( 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 @@ -244,8 +256,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -257,6 +270,7 @@ 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 @@ -281,12 +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) + 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 + 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, @@ -298,17 +311,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -318,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -346,7 +366,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +378,7 @@ 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 ) @@ -377,10 +399,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace_async async def get( @@ -396,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) @@ -409,18 +430,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -434,7 +462,7 @@ async def get( 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 @@ -453,6 +481,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -464,6 +494,7 @@ def prepare_request(next_link=None): 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) @@ -474,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -491,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]: @@ -504,7 +540,7 @@ async def get_next(next_link=None): 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( @@ -520,6 +556,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +568,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +578,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,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]: @@ -569,4 +613,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_log_analytics_operations.py index 632e5cd95bd6..a1ffabdc1d48 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -58,6 +57,7 @@ async def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -65,6 +65,7 @@ async def _export_request_rate_by_interval_initial( 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'], @@ -72,7 +73,11 @@ async def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -88,7 +93,7 @@ async def _export_request_rate_by_interval_initial( 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 @@ -119,8 +124,9 @@ async def begin_export_request_rate_by_interval( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ 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 @@ -155,10 +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) + 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 + 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, @@ -172,6 +178,7 @@ async def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -179,6 +186,7 @@ async def _export_throttled_requests_initial( 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'], @@ -186,7 +194,11 @@ async def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -202,7 +214,7 @@ async def _export_throttled_requests_initial( 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 @@ -233,8 +245,9 @@ async def begin_export_throttled_requests( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +258,7 @@ 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 @@ -269,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_operations.py index 4b5ca3519f1b..6bd3991e0d31 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,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]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_proximity_placement_groups_operations.py index f40c1350757b..aa2a9a66354c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -73,6 +72,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -81,6 +81,7 @@ async def create_or_update( 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'], @@ -88,7 +89,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -106,7 +111,7 @@ async def create_or_update( 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 @@ -136,6 +141,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -144,6 +150,7 @@ async def update( 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'], @@ -151,7 +158,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -165,11 +176,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -192,17 +203,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -212,7 +230,7 @@ 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 @@ -230,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) @@ -243,18 +261,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -268,7 +293,7 @@ async def get( 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 @@ -285,6 +310,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -295,6 +322,7 @@ def prepare_request(next_link=None): 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) @@ -304,6 +332,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -321,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]: @@ -334,7 +367,7 @@ async def get_next(next_link=None): 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( @@ -353,6 +386,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -364,6 +399,7 @@ def prepare_request(next_link=None): 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) @@ -374,6 +410,7 @@ def prepare_request(next_link=None): 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) @@ -391,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]: @@ -404,4 +445,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_restore_point_collections_operations.py index 3932b584ed3a..80fafbfb7d22 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -78,6 +77,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollection') @@ -86,6 +86,7 @@ async def create_or_update( 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'], @@ -93,7 +94,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -111,7 +116,7 @@ async def create_or_update( 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 @@ -141,6 +146,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') @@ -149,6 +155,7 @@ async def update( 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'], @@ -156,7 +163,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -170,10 +181,10 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -185,17 +196,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -205,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -234,7 +252,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -245,6 +264,7 @@ 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 ) @@ -265,10 +285,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore @distributed_trace_async async def get( @@ -285,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_11_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) @@ -298,18 +317,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -323,7 +349,7 @@ async def get( 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 @@ -343,6 +369,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -354,6 +382,7 @@ def prepare_request(next_link=None): 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) @@ -364,6 +393,7 @@ def prepare_request(next_link=None): 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) @@ -381,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]: @@ -394,7 +428,7 @@ async def get_next(next_link=None): 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( @@ -412,6 +446,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -422,6 +458,7 @@ def prepare_request(next_link=None): 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) @@ -431,6 +468,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -448,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]: @@ -461,4 +503,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_restore_points_operations.py index 61bccb07e0fe..1f2d8734a150 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePoint') @@ -69,6 +69,7 @@ async def _create_initial( 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'], @@ -76,7 +77,11 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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 [201]: @@ -90,7 +95,7 @@ async def _create_initial( 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 @@ -126,8 +131,9 @@ async def begin_create( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.RestorePoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ 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 @@ -164,12 +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) + 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 + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -182,18 +188,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -203,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -234,7 +247,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -246,6 +260,7 @@ 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 ) @@ -266,10 +281,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore @distributed_trace_async async def get( @@ -289,7 +303,7 @@ async def get( :param restore_point_name: The name of the restore point. :type restore_point_name: str :param expand: The expand expression to apply on the operation. 'InstanceView' retrieves - information about the run-time state of a restore point. + information about the run-time state of a restore point. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_11_01.models.RestorePointExpandOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: RestorePoint, or the result of cls(response) @@ -302,19 +316,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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, expand=expand, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -328,5 +349,5 @@ async def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_ssh_public_keys_operations.py index 98d54a1d6acd..1a54ea8a7900 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -71,6 +72,7 @@ def prepare_request(next_link=None): 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) @@ -80,6 +82,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -97,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]: @@ -110,7 +117,7 @@ async def get_next(next_link=None): 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( @@ -130,6 +137,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -141,6 +150,7 @@ def prepare_request(next_link=None): 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) @@ -151,6 +161,7 @@ def prepare_request(next_link=None): 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) @@ -168,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]: @@ -181,7 +196,7 @@ async def get_next(next_link=None): 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( @@ -210,6 +225,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -218,6 +234,7 @@ async def create( 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'], @@ -225,7 +242,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -243,7 +264,7 @@ async def create( 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 @@ -273,6 +294,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -281,6 +303,7 @@ async def update( 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'], @@ -288,7 +311,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,11 +329,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -329,17 +356,24 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -349,7 +383,7 @@ 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 @@ -376,17 +410,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -400,7 +441,7 @@ async def get( 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 @@ -429,17 +470,24 @@ async def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -453,5 +501,5 @@ async def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_usage_operations.py index 4fb0ff8d3e1a..20292e54c926 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -63,6 +61,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): 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) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,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]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_extension_images_operations.py index a03885c4b1ea..72d50f5bd8e1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -74,6 +73,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_get_request( location=location, @@ -81,12 +82,17 @@ async def get( 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(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]: @@ -100,7 +106,7 @@ async def get( 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 @@ -127,17 +133,24 @@ async def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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]: @@ -151,7 +164,7 @@ async def list_types( 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 @@ -173,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) @@ -190,12 +203,15 @@ async def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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, @@ -204,7 +220,11 @@ async def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,5 +238,5 @@ async def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_extensions_operations.py index 9b7436140b97..f80814588fbe 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -60,6 +59,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -69,6 +69,7 @@ async def _create_or_update_initial( 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'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( 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 @@ -132,8 +137,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -146,6 +152,7 @@ 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 @@ -170,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore async def _update_initial( self, @@ -189,6 +195,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -198,6 +205,7 @@ async def _update_initial( 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'], @@ -205,7 +213,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -219,7 +231,7 @@ async def _update_initial( 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 @@ -257,8 +269,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -271,6 +284,7 @@ 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 @@ -295,12 +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) + 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 + 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, @@ -313,18 +326,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -334,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -365,7 +385,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -377,6 +398,7 @@ 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 ) @@ -397,10 +419,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -419,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) @@ -432,19 +453,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -458,7 +486,7 @@ async def get( 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 @@ -475,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) @@ -488,18 +516,25 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -513,5 +548,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_images_edge_zone_operations.py index c58af16fe089..78c1cc6a2ac6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -80,6 +79,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_get_request( location=location, @@ -89,12 +90,17 @@ async def get( 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(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,7 +114,7 @@ async def get( 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 @@ -137,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) @@ -155,6 +162,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_list_request( location=location, @@ -163,6 +172,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -171,7 +181,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -185,7 +199,7 @@ async def list( 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 @@ -216,18 +230,25 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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]: @@ -241,7 +262,7 @@ async def list_offers( 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 @@ -268,17 +289,24 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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,7 +320,7 @@ async def list_publishers( 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 @@ -326,6 +354,8 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_list_skus_request( location=location, @@ -333,12 +363,17 @@ async def list_skus( 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(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]: @@ -352,5 +387,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_images_operations.py index 837e5c662ca8..13dc61164084 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -77,6 +76,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_get_request( location=location, @@ -85,12 +86,17 @@ async def get( 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(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]: @@ -104,7 +110,7 @@ async def get( 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 @@ -130,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) @@ -147,6 +153,8 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_list_request( location=location, @@ -154,6 +162,7 @@ async def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -162,7 +171,11 @@ async def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -176,7 +189,7 @@ async def list( 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 @@ -203,17 +216,24 @@ async def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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]: @@ -227,7 +247,7 @@ async def list_offers( 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 @@ -251,16 +271,23 @@ async def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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]: @@ -274,7 +301,7 @@ async def list_publishers( 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 @@ -304,18 +331,25 @@ async def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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]: @@ -329,5 +363,5 @@ async def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_run_commands_operations.py index 0ac8cee746b6..856d496d8311 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -65,6 +64,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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( @@ -142,17 +149,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -166,7 +180,7 @@ async def get( 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( @@ -175,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"] @@ -183,7 +199,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -192,6 +208,7 @@ async def _create_or_update_initial( 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'], @@ -199,7 +216,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -217,7 +238,7 @@ async def _create_or_update_initial( 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 @@ -227,6 +248,8 @@ async def begin_create_or_update( 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. @@ -240,6 +263,9 @@ 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_11_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 @@ -254,8 +280,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -269,6 +295,7 @@ async def begin_create_or_update( 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 ) @@ -292,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore async def _update_initial( self, @@ -303,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"] @@ -311,7 +339,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -320,6 +348,7 @@ async def _update_initial( 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'], @@ -327,7 +356,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,7 +374,7 @@ async def _update_initial( 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 @@ -351,6 +384,8 @@ async def begin_update( 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. @@ -363,6 +398,9 @@ 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_11_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 @@ -377,8 +415,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -392,6 +430,7 @@ async def begin_update( 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 ) @@ -415,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -433,18 +471,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -454,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -485,7 +530,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -497,6 +543,7 @@ 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 ) @@ -517,10 +564,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) + 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 + 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( @@ -539,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) @@ -552,19 +598,26 @@ async def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -578,7 +631,7 @@ async def get_by_virtual_machine( 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 @@ -595,7 +648,7 @@ 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 @@ -604,6 +657,8 @@ def list_by_virtual_machine( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -616,6 +671,7 @@ def prepare_request(next_link=None): 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'], ) @@ -628,6 +684,7 @@ def prepare_request(next_link=None): 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, ) @@ -646,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]: @@ -659,4 +720,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py index 2cfda6d36dfb..e428de269c37 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -62,6 +61,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -135,8 +140,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -149,6 +155,7 @@ 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 @@ -173,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore async def _update_initial( self, @@ -192,6 +198,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -201,6 +208,7 @@ async def _update_initial( 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'], @@ -208,7 +216,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -226,7 +238,7 @@ async def _update_initial( 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 @@ -264,8 +276,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,6 +291,7 @@ 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 @@ -302,12 +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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # 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, @@ -320,18 +333,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -341,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -372,7 +392,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -384,6 +405,7 @@ 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 ) @@ -404,10 +426,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace_async async def get( @@ -426,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) @@ -439,19 +460,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -465,7 +493,7 @@ async def get( 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 @@ -488,6 +516,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -500,6 +530,7 @@ def prepare_request(next_link=None): 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) @@ -511,6 +542,7 @@ def prepare_request(next_link=None): 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) @@ -528,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]: @@ -541,4 +577,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index c517e855bdd1..e67499231789 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -46,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, @@ -58,17 +57,24 @@ async def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -78,11 +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 @distributed_trace_async - async def begin_cancel( + async def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -106,7 +112,8 @@ async def begin_cancel( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -117,6 +124,7 @@ 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 ) @@ -137,12 +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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - async def _start_os_upgrade_initial( + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -154,17 +161,24 @@ async def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -174,11 +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 @distributed_trace_async - async def begin_start_os_upgrade( + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -204,7 +218,8 @@ async def begin_start_os_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +230,7 @@ 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 ) @@ -235,12 +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) + 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 + 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, @@ -252,17 +267,24 @@ async def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -272,11 +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 @distributed_trace_async - async def begin_start_extension_upgrade( + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -302,7 +324,8 @@ async def begin_start_extension_upgrade( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,6 +336,7 @@ 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 ) @@ -333,10 +357,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) + 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 + 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( @@ -362,17 +385,24 @@ async def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -386,5 +416,5 @@ async def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py index 029e998d778b..6eeab40b6783 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') @@ -71,6 +71,7 @@ async def _create_or_update_initial( 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'], @@ -78,7 +79,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -96,7 +101,7 @@ async def _create_or_update_initial( 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 @@ -137,8 +142,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -152,6 +158,7 @@ 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 @@ -176,10 +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) + 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 + 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, @@ -196,6 +202,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') @@ -206,6 +213,7 @@ async def _update_initial( 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'], @@ -213,7 +221,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +239,7 @@ async def _update_initial( 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 @@ -268,8 +280,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -283,6 +296,7 @@ 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 @@ -307,12 +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) + 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 + 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, @@ -326,6 +339,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -333,12 +348,17 @@ async def _delete_initial( 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) - 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]: @@ -348,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -382,7 +402,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -395,6 +416,7 @@ 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 ) @@ -415,10 +437,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) + 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 + 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( @@ -440,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) @@ -453,6 +474,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -460,13 +483,18 @@ async def get( 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) - 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]: @@ -480,7 +508,7 @@ async def get( 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 @@ -500,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) @@ -513,19 +541,26 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -539,5 +574,5 @@ async def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 8bde3ba02889..3d2a1e0e8b64 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -55,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"] @@ -63,7 +64,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -73,6 +74,7 @@ async def _create_or_update_initial( 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'], @@ -80,7 +82,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -98,7 +104,7 @@ async def _create_or_update_initial( 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 @@ -109,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. @@ -123,6 +131,9 @@ 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_11_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 @@ -137,8 +148,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -153,6 +164,7 @@ async def begin_create_or_update( 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 ) @@ -176,10 +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) + 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 + 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, @@ -188,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"] @@ -196,7 +209,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -206,6 +219,7 @@ async def _update_initial( 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'], @@ -213,7 +227,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -227,7 +245,7 @@ async def _update_initial( 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 @@ -238,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. @@ -252,6 +272,9 @@ 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_11_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 @@ -266,8 +289,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -282,6 +305,7 @@ async def begin_update( 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 ) @@ -305,12 +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) + 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 + 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, @@ -324,6 +347,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -331,12 +356,17 @@ async def _delete_initial( 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) - 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]: @@ -346,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -380,7 +410,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -393,6 +424,7 @@ 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 ) @@ -413,10 +445,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) + 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 + 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( @@ -438,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) @@ -451,6 +482,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -458,13 +491,18 @@ async def get( 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) - 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]: @@ -478,7 +516,7 @@ async def get( 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 @@ -498,7 +536,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -507,6 +545,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -520,6 +560,7 @@ def prepare_request(next_link=None): 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'], ) @@ -533,6 +574,7 @@ def prepare_request(next_link=None): 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, ) @@ -551,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]: @@ -564,4 +610,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_vms_operations.py index cc589f57cc2b..60cf568fa9e7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -48,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, @@ -62,6 +61,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -74,6 +74,7 @@ async def _reimage_initial( 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'], @@ -81,7 +82,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -91,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -112,6 +117,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -126,8 +132,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +147,7 @@ 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 @@ -161,12 +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) + 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 + 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, @@ -179,18 +186,25 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -200,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -232,7 +246,8 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -244,6 +259,7 @@ 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 ) @@ -264,12 +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) + 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 + 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, @@ -282,18 +297,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -303,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -336,7 +358,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -348,6 +371,7 @@ 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 ) @@ -368,10 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate"} # type: ignore async def _update_initial( self, @@ -387,6 +410,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -396,6 +420,7 @@ async def _update_initial( 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'], @@ -403,7 +428,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -421,7 +450,7 @@ async def _update_initial( 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 @@ -458,8 +487,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -472,6 +502,7 @@ 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 @@ -496,12 +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) + 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 + 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, @@ -515,19 +545,26 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -537,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -558,7 +595,7 @@ 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. @@ -572,7 +609,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -585,6 +623,7 @@ 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 ) @@ -605,10 +644,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}"} # type: ignore @distributed_trace_async async def get( @@ -629,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_11_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) @@ -642,19 +680,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -668,7 +713,7 @@ async def get( 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 @@ -698,18 +743,25 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -723,7 +775,7 @@ async def get_instance_view( 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 @@ -744,12 +796,13 @@ 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 @@ -758,6 +811,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -770,6 +825,7 @@ def prepare_request(next_link=None): 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, @@ -784,6 +840,7 @@ def prepare_request(next_link=None): 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, @@ -804,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]: @@ -817,9 +878,9 @@ async def get_next(next_link=None): 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, @@ -833,19 +894,26 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -855,11 +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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -879,7 +947,7 @@ 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. @@ -893,7 +961,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -906,6 +975,7 @@ 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 ) @@ -926,12 +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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -944,18 +1013,25 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -965,11 +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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -996,7 +1072,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1008,6 +1085,7 @@ 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 ) @@ -1028,12 +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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1046,18 +1123,25 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1067,11 +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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1098,7 +1182,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1110,6 +1195,7 @@ 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 ) @@ -1130,12 +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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/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, @@ -1148,18 +1233,25 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1169,11 +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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1201,7 +1293,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1213,6 +1306,7 @@ 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 ) @@ -1233,10 +1327,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) + 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 + 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( @@ -1258,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) @@ -1271,19 +1364,26 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -1297,10 +1397,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + 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( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1313,18 +1413,25 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1334,11 +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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1365,7 +1472,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1377,6 +1485,7 @@ 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 ) @@ -1397,13 +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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1429,18 +1537,25 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -1450,7 +1565,7 @@ 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( @@ -1459,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"]] @@ -1467,7 +1584,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -1476,6 +1593,7 @@ async def _run_command_initial( 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'], @@ -1483,7 +1601,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1499,7 +1621,7 @@ async def _run_command_initial( 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 @@ -1509,6 +1631,8 @@ async def begin_run_command( 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. @@ -1521,6 +1645,9 @@ async def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_11_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 @@ -1535,8 +1662,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -1550,6 +1677,7 @@ async def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1573,7 +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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_sets_operations.py index cb27989a6ee5..0f9a682f667c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -139,6 +147,7 @@ async def _create_or_update_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'], @@ -146,7 +155,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -164,7 +177,7 @@ async def _create_or_update_initial( 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 @@ -197,8 +210,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -210,6 +224,7 @@ 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 @@ -234,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore async def _update_initial( self, @@ -252,6 +266,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -260,6 +275,7 @@ async def _update_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'], @@ -267,7 +283,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -281,7 +301,7 @@ async def _update_initial( 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 @@ -314,8 +334,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -327,6 +348,7 @@ 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 @@ -351,12 +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) + 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 + 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, @@ -369,18 +390,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -390,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -408,6 +436,7 @@ 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. @@ -421,7 +450,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -433,6 +463,7 @@ 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 ) @@ -453,10 +484,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace_async async def get( @@ -474,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_11_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) @@ -487,18 +517,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -512,10 +549,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # 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, @@ -528,6 +565,7 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -539,6 +577,7 @@ async def _deallocate_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'], @@ -546,7 +585,11 @@ async def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -556,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -575,7 +618,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -590,8 +634,9 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -603,6 +648,7 @@ 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 @@ -624,12 +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) + 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 + 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, @@ -643,6 +688,7 @@ async def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -651,6 +697,7 @@ async def _delete_instances_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, @@ -659,7 +706,11 @@ async def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -669,11 +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 @distributed_trace_async - async def begin_delete_instances( + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -691,7 +742,7 @@ async def begin_delete_instances( :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_11_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. @@ -705,8 +756,9 @@ async def begin_delete_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -719,6 +771,7 @@ 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 @@ -740,10 +793,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) + 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 + 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( @@ -769,17 +821,24 @@ async def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -793,7 +852,7 @@ async def get_instance_view( 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 @@ -813,6 +872,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -824,6 +885,7 @@ def prepare_request(next_link=None): 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) @@ -834,6 +896,7 @@ def prepare_request(next_link=None): 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) @@ -851,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]: @@ -864,7 +931,7 @@ async def get_next(next_link=None): 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( @@ -882,6 +949,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -892,6 +961,7 @@ def prepare_request(next_link=None): 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) @@ -901,6 +971,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -918,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]: @@ -931,7 +1006,7 @@ async def get_next(next_link=None): 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( @@ -954,6 +1029,8 @@ def list_skus( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -966,6 +1043,7 @@ def prepare_request(next_link=None): 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) @@ -977,6 +1055,7 @@ def prepare_request(next_link=None): 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) @@ -994,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]: @@ -1007,7 +1090,7 @@ async def get_next(next_link=None): 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( @@ -1029,6 +1112,8 @@ def get_os_upgrade_history( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1041,6 +1126,7 @@ def prepare_request(next_link=None): 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) @@ -1052,6 +1138,7 @@ def prepare_request(next_link=None): 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) @@ -1069,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]: @@ -1082,9 +1173,9 @@ async def get_next(next_link=None): 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, @@ -1098,6 +1189,7 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1109,6 +1201,7 @@ async def _power_off_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, @@ -1117,7 +1210,11 @@ async def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1127,11 +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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1149,9 +1246,10 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1166,8 +1264,9 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1180,6 +1279,7 @@ 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 @@ -1201,12 +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) + 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 + 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, @@ -1219,6 +1318,7 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1230,6 +1330,7 @@ async def _restart_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'], @@ -1237,7 +1338,11 @@ async def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1247,11 +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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1264,7 +1369,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1279,8 +1385,9 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1292,6 +1399,7 @@ 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 @@ -1313,12 +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) + 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 + 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, @@ -1331,6 +1438,7 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1342,6 +1450,7 @@ async def _start_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'], @@ -1349,7 +1458,11 @@ async def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1359,11 +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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1376,7 +1489,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1391,8 +1505,9 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1404,6 +1519,7 @@ 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 @@ -1425,12 +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) + 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 + 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, @@ -1443,6 +1558,7 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1454,6 +1570,7 @@ async def _redeploy_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'], @@ -1461,7 +1578,11 @@ async def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1471,11 +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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1489,7 +1610,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1504,8 +1626,9 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1517,6 +1640,7 @@ 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 @@ -1538,12 +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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1556,6 +1679,7 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1567,6 +1691,7 @@ async def _perform_maintenance_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'], @@ -1574,7 +1699,11 @@ async def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1584,11 +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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1604,7 +1733,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1619,8 +1749,9 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1632,6 +1763,7 @@ 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 @@ -1653,12 +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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore - async def _update_instances_initial( + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1671,6 +1802,7 @@ async def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1679,6 +1811,7 @@ async def _update_instances_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'], @@ -1686,7 +1819,11 @@ async def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1696,11 +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 @distributed_trace_async - async def begin_update_instances( + async def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1728,8 +1865,9 @@ async def begin_update_instances( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1741,6 +1879,7 @@ 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 @@ -1762,12 +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) + 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 + 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, @@ -1780,6 +1918,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -1791,6 +1930,7 @@ async def _reimage_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'], @@ -1798,7 +1938,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1808,11 +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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1827,7 +1971,7 @@ 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. + :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_11_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -1842,8 +1986,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1855,6 +2000,7 @@ 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 @@ -1876,12 +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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/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, @@ -1894,6 +2039,7 @@ async def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1905,6 +2051,7 @@ async def _reimage_all_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'], @@ -1912,7 +2059,11 @@ async def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1922,11 +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 @distributed_trace_async - async def begin_reimage_all( + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1940,7 +2091,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1955,8 +2107,9 @@ async def begin_reimage_all( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1968,6 +2121,7 @@ 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 @@ -1989,10 +2143,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) + 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 + 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( @@ -2015,10 +2168,10 @@ async def force_recovery_service_fabric_platform_update_domain_walk( requested. :type platform_update_domain: int :param zone: The zone in which the manual recovery walk is requested for cross zone virtual - machine scale set. + machine scale set. Default value is None. :type zone: str :param placement_group_id: The placement group id for which the manual recovery walk is - requested. + requested. Default value is None. :type placement_group_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RecoveryWalkResponse, or the result of cls(response) @@ -2031,11 +2184,14 @@ async def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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, zone=zone, placement_group_id=placement_group_id, @@ -2044,7 +2200,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2058,11 +2218,11 @@ async def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + async def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2089,6 +2249,7 @@ async def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -2097,6 +2258,7 @@ async def convert_to_single_placement_group( 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'], @@ -2104,7 +2266,11 @@ async def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2114,10 +2280,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, @@ -2130,6 +2296,7 @@ async def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -2138,6 +2305,7 @@ async def _set_orchestration_service_state_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'], @@ -2145,7 +2313,11 @@ async def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2155,11 +2327,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 @distributed_trace_async - async def begin_set_orchestration_service_state( + async def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2186,8 +2358,9 @@ async def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2199,6 +2372,7 @@ 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 @@ -2220,7 +2394,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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_sizes_operations.py index 7ea257c85003..3abad7e8984d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -15,7 +14,6 @@ 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 @@ -64,6 +62,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -75,6 +75,7 @@ def prepare_request(next_link=None): 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) @@ -85,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -102,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]: @@ -115,4 +121,4 @@ async def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machines_operations.py index 2fe347a7f597..fac2d874fd07 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/aio/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -26,7 +25,7 @@ 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 @@ -65,6 +64,8 @@ def list_by_location( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -76,6 +77,7 @@ def prepare_request(next_link=None): 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) @@ -86,6 +88,7 @@ def prepare_request(next_link=None): 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) @@ -103,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]: @@ -116,7 +123,7 @@ async def get_next(next_link=None): 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, @@ -131,6 +138,7 @@ async def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -139,6 +147,7 @@ async def _capture_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'], @@ -146,7 +155,11 @@ async def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -162,7 +175,7 @@ async def _capture_initial( 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 @@ -196,8 +209,9 @@ async def begin_capture( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,6 +223,7 @@ 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 @@ -233,10 +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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore async def _create_or_update_initial( self, @@ -251,6 +265,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -259,6 +274,7 @@ async def _create_or_update_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'], @@ -266,7 +282,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -284,7 +304,7 @@ async def _create_or_update_initial( 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 @@ -318,8 +338,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,6 +352,7 @@ 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 @@ -355,10 +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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore async def _update_initial( self, @@ -373,6 +394,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -381,6 +403,7 @@ async def _update_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'], @@ -388,7 +411,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -402,7 +429,7 @@ async def _update_initial( 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 @@ -435,8 +462,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -448,6 +476,7 @@ 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 @@ -472,12 +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) + 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 + 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, @@ -490,18 +518,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -511,11 +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 @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -528,7 +563,8 @@ 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. @@ -542,7 +578,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -554,6 +591,7 @@ 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 ) @@ -574,10 +612,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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace_async async def get( @@ -597,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_11_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) @@ -609,18 +647,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -634,7 +679,7 @@ async def get( 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 @@ -661,17 +706,24 @@ async def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -685,10 +737,10 @@ async def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - async def _convert_to_managed_disks_initial( + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -700,17 +752,24 @@ async def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -720,11 +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 @distributed_trace_async - async def begin_convert_to_managed_disks( + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -749,7 +808,8 @@ async def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -760,6 +820,7 @@ 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 ) @@ -780,12 +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) + 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 + 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, @@ -798,18 +858,25 @@ async def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -819,11 +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 @distributed_trace_async - async def begin_deallocate( + async def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -838,6 +905,7 @@ 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. @@ -851,7 +919,8 @@ async def begin_deallocate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -863,6 +932,7 @@ 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 ) @@ -883,13 +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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace_async - async def generalize( + async def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -917,17 +986,24 @@ async def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -937,7 +1013,7 @@ 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 @@ -955,6 +1031,7 @@ def list( :param filter: The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualMachineListResult or the result of @@ -963,6 +1040,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -974,6 +1053,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -985,6 +1065,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -1003,7 +1084,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]: @@ -1016,7 +1101,7 @@ async def get_next(next_link=None): 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( @@ -1029,11 +1114,12 @@ 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 :param filter: The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualMachineListResult or the result of @@ -1042,6 +1128,8 @@ def list_all( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1052,6 +1140,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, filter=filter, template_url=self.list_all.metadata['url'], @@ -1063,6 +1152,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, filter=filter, template_url=next_link, @@ -1082,7 +1172,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]: @@ -1095,7 +1189,7 @@ async def get_next(next_link=None): 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( @@ -1118,6 +1212,8 @@ def list_available_sizes( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1130,6 +1226,7 @@ def prepare_request(next_link=None): 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) @@ -1141,6 +1238,7 @@ def prepare_request(next_link=None): 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) @@ -1158,7 +1256,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]: @@ -1171,9 +1273,9 @@ async def get_next(next_link=None): 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, @@ -1186,18 +1288,25 @@ async def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -1207,11 +1316,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 @distributed_trace_async - async def begin_power_off( + async def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1227,7 +1336,7 @@ 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. @@ -1241,7 +1350,8 @@ async def begin_power_off( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1253,6 +1363,7 @@ 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 ) @@ -1273,12 +1384,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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore - async def _reapply_initial( + async def _reapply_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1290,17 +1400,24 @@ async def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -1310,11 +1427,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 @distributed_trace_async - async def begin_reapply( + async def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1338,7 +1455,8 @@ async def begin_reapply( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1349,6 +1467,7 @@ 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 ) @@ -1369,12 +1488,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) + 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 + begin_reapply.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1386,17 +1504,24 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -1406,11 +1531,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 @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1434,7 +1559,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1445,6 +1571,7 @@ 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 ) @@ -1465,12 +1592,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) + 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 + 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, @@ -1482,17 +1608,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -1502,11 +1635,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 @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1530,7 +1663,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1541,6 +1675,7 @@ 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 ) @@ -1561,12 +1696,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) + 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 + 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, @@ -1578,17 +1712,24 @@ async def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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,11 +1739,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 @distributed_trace_async - async def begin_redeploy( + async def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1626,7 +1767,8 @@ async def begin_redeploy( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1637,6 +1779,7 @@ 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 ) @@ -1657,12 +1800,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) + 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 + 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, @@ -1675,6 +1817,7 @@ async def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -1686,6 +1829,7 @@ async def _reimage_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'], @@ -1693,7 +1837,11 @@ async def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1703,11 +1851,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 @distributed_trace_async - async def begin_reimage( + async def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1720,7 +1868,8 @@ 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_11_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. @@ -1734,8 +1883,9 @@ async def begin_reimage( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1747,6 +1897,7 @@ 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 @@ -1768,10 +1919,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) + 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 + 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( @@ -1789,7 +1939,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) @@ -1802,18 +1952,25 @@ async def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -1827,10 +1984,10 @@ async def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - async def _perform_maintenance_initial( + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1842,17 +1999,24 @@ async def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -1862,11 +2026,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 @distributed_trace_async - async def begin_perform_maintenance( + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1890,7 +2054,8 @@ async def begin_perform_maintenance( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1901,6 +2066,7 @@ 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 ) @@ -1921,13 +2087,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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace_async - async def simulate_eviction( + async def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1950,17 +2115,24 @@ async def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -1970,7 +2142,7 @@ 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( @@ -1985,17 +2157,24 @@ async def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -2011,7 +2190,7 @@ async def _assess_patches_initial( 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 @@ -2041,7 +2220,8 @@ async def begin_assess_patches( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -2052,6 +2232,7 @@ 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 ) @@ -2075,10 +2256,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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore async def _install_patches_initial( self, @@ -2093,6 +2273,7 @@ async def _install_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') @@ -2101,6 +2282,7 @@ async def _install_patches_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'], @@ -2108,7 +2290,11 @@ async def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2124,7 +2310,7 @@ async def _install_patches_initial( 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 @@ -2158,8 +2344,9 @@ async def begin_install_patches( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineInstallPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -2171,6 +2358,7 @@ 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 @@ -2195,16 +2383,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) + 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 + 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"]] @@ -2213,7 +2402,7 @@ async def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2221,6 +2410,7 @@ async def _run_command_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'], @@ -2228,7 +2418,11 @@ async def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2244,7 +2438,7 @@ async def _run_command_initial( 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 @@ -2253,6 +2447,8 @@ async def begin_run_command( 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. @@ -2263,6 +2459,9 @@ async def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_11_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 @@ -2277,8 +2476,8 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_11_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -2291,6 +2490,7 @@ async def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2314,7 +2514,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_compute_management_client_enums.py index cc45c3208c4b..2c98ae0d7296 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_compute_management_client_enums.py @@ -276,7 +276,6 @@ class OrchestrationServiceNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enu """ AUTOMATIC_REPAIRS = "AutomaticRepairs" - DUMMY_ORCHESTRATION_SERVICE_NAME = "DummyOrchestrationServiceName" class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the service. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_models_py3.py index 5b06f8d55e7c..e3ac5c6ae804 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/models/_models_py3.py @@ -4339,7 +4339,7 @@ class OrchestrationServiceStateInput(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2021_11_01.models.OrchestrationServiceNames :ivar action: Required. The action to be performed. Possible values include: "Resume", "Suspend". @@ -4365,7 +4365,7 @@ def __init__( ): """ :keyword service_name: Required. The name of the service. Possible values include: - "AutomaticRepairs", "DummyOrchestrationServiceName". + "AutomaticRepairs". :paramtype service_name: str or ~azure.mgmt.compute.v2021_11_01.models.OrchestrationServiceNames :keyword action: Required. The action to be performed. Possible values include: "Resume", @@ -4383,8 +4383,7 @@ class OrchestrationServiceSummary(msrest.serialization.Model): 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". + :ivar service_name: The name of the service. Possible values include: "AutomaticRepairs". :vartype service_name: str or ~azure.mgmt.compute.v2021_11_01.models.OrchestrationServiceNames :ivar service_state: The current state of the service. Possible values include: "NotRunning", "Running", "Suspended". @@ -4670,9 +4669,8 @@ class OSProfile(msrest.serialization.Model): the virtual machine. :code:`
`:code:`
`This may only be set to False when no extensions are present on the virtual machine. :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.**. + :ivar require_guest_provision_signal: Optional property which must either be set to True or + omitted. :vartype require_guest_provision_signal: bool """ @@ -4766,9 +4764,8 @@ def __init__( 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.**. + :keyword require_guest_provision_signal: Optional property which must either be set to True or + omitted. :paramtype require_guest_provision_signal: bool """ super(OSProfile, self).__init__(**kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_availability_sets_operations.py index d4abc2789f69..f995494c208a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_availability_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,31 +121,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -156,31 +157,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -191,31 +193,32 @@ def build_list_by_subscription_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -225,30 +228,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -259,31 +263,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -336,6 +341,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySet') @@ -344,6 +350,7 @@ def create_or_update( 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'], @@ -351,7 +358,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -365,7 +376,7 @@ def create_or_update( 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 @@ -395,6 +406,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AvailabilitySetUpdate') @@ -403,6 +415,7 @@ def update( 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'], @@ -410,7 +423,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -424,11 +441,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, availability_set_name: str, @@ -451,17 +468,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -471,7 +495,7 @@ 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 @@ -498,17 +522,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -522,7 +553,7 @@ def get( 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 @@ -534,7 +565,7 @@ 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 @@ -543,6 +574,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -553,6 +586,7 @@ def prepare_request(next_link=None): 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'], ) @@ -563,6 +597,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -581,7 +616,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]: @@ -594,7 +633,7 @@ def get_next(next_link=None): 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( @@ -613,6 +652,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.AvailabilitySetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -624,6 +665,7 @@ def prepare_request(next_link=None): 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) @@ -634,6 +676,7 @@ def prepare_request(next_link=None): 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) @@ -651,7 +694,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]: @@ -664,7 +711,7 @@ def get_next(next_link=None): 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( @@ -687,6 +734,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -699,6 +748,7 @@ def prepare_request(next_link=None): 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) @@ -710,6 +760,7 @@ def prepare_request(next_link=None): 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) @@ -727,7 +778,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]: @@ -740,4 +795,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_capacity_reservation_groups_operations.py index 758361a734f0..edc4fdf63d94 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_capacity_reservation_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,31 +121,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,33 +159,34 @@ def build_get_request( expand: Optional[Union[str, "_models.CapacityReservationGroupInstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,32 +198,33 @@ def build_list_by_resource_group_request( expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -232,31 +235,32 @@ def build_list_by_subscription_request( expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -311,6 +315,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationGroup') @@ -319,6 +324,7 @@ def create_or_update( 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'], @@ -326,7 +332,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -344,7 +354,7 @@ def create_or_update( 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 @@ -375,6 +385,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationGroupUpdate') @@ -383,6 +394,7 @@ def update( 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'], @@ -390,7 +402,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -404,11 +420,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -434,17 +450,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -454,7 +477,7 @@ 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 @@ -474,7 +497,7 @@ 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. + platform and can change outside of control plane operations. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_11_01.models.CapacityReservationGroupInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response @@ -488,18 +511,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -513,7 +543,7 @@ def get( 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 @@ -530,7 +560,7 @@ 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. + associated to capacity reservation group in the response. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_11_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response @@ -540,6 +570,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -551,6 +583,7 @@ def prepare_request(next_link=None): 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'], ) @@ -562,6 +595,7 @@ def prepare_request(next_link=None): 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, ) @@ -580,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]: @@ -593,7 +631,7 @@ def get_next(next_link=None): 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( @@ -606,7 +644,7 @@ 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. + associated to capacity reservation group in the response. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_11_01.models.ExpandTypesForGetCapacityReservationGroups :keyword callable cls: A custom type or function that will be passed the direct response @@ -616,6 +654,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.CapacityReservationGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -626,6 +666,7 @@ def prepare_request(next_link=None): 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'], ) @@ -636,6 +677,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, template_url=next_link, ) @@ -654,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]: @@ -667,4 +713,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_capacity_reservations_operations.py index 6681ff287fda..8e65deaf637c 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_capacity_reservations_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + _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'), @@ -139,21 +140,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -167,10 +168,11 @@ def build_get_request( expand: Optional[Union[str, "_models.CapacityReservationInstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}') + _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'), @@ -178,23 +180,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -205,31 +207,32 @@ def build_list_by_capacity_reservation_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -269,6 +272,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservation') @@ -278,6 +282,7 @@ def _create_or_update_initial( 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'], @@ -285,7 +290,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -303,7 +312,7 @@ def _create_or_update_initial( 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 @@ -341,8 +350,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.CapacityReservation] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -355,6 +365,7 @@ 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 @@ -379,10 +390,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore def _update_initial( self, @@ -398,6 +408,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CapacityReservationUpdate') @@ -407,6 +418,7 @@ def _update_initial( 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'], @@ -414,7 +426,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -430,7 +446,7 @@ def _update_initial( 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 @@ -466,8 +482,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.CapacityReservation] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservation"] lro_delay = kwargs.pop( 'polling_interval', @@ -480,6 +497,7 @@ 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 @@ -504,12 +522,11 @@ 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) + 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 + 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: str, capacity_reservation_group_name: str, @@ -522,18 +539,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -543,11 +567,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, capacity_reservation_group_name: str, @@ -576,7 +600,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -588,6 +613,7 @@ 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 ) @@ -608,10 +634,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore @distributed_trace def get( @@ -632,7 +657,7 @@ 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. + and can change outside of control plane operations. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_11_01.models.CapacityReservationInstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response @@ -646,19 +671,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -672,7 +704,7 @@ def get( 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 @@ -696,6 +728,8 @@ def list_by_capacity_reservation_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.CapacityReservationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -708,6 +742,7 @@ def prepare_request(next_link=None): 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) @@ -719,6 +754,7 @@ def prepare_request(next_link=None): 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) @@ -736,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]: @@ -749,4 +789,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_dedicated_host_groups_operations.py index c5c695e10ef6..2572e10ef881 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_dedicated_host_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,31 +121,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,33 +159,34 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -194,30 +196,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -226,29 +229,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -303,6 +307,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroup') @@ -311,6 +316,7 @@ def create_or_update( 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'], @@ -318,7 +324,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -336,7 +346,7 @@ def create_or_update( 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 @@ -366,6 +376,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') @@ -374,6 +385,7 @@ def update( 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'], @@ -381,7 +393,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -395,11 +411,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -422,17 +438,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -442,7 +465,7 @@ 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 @@ -461,7 +484,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_11_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) @@ -474,18 +497,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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 +529,7 @@ def get( 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 @@ -520,6 +550,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -531,6 +563,7 @@ def prepare_request(next_link=None): 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) @@ -541,6 +574,7 @@ def prepare_request(next_link=None): 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) @@ -558,7 +592,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]: @@ -571,7 +609,7 @@ def get_next(next_link=None): 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( @@ -588,6 +626,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.DedicatedHostGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -598,6 +638,7 @@ def prepare_request(next_link=None): 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) @@ -607,6 +648,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -624,7 +666,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]: @@ -637,4 +683,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_dedicated_hosts_operations.py index 1cf3930eb115..333fe7ea3837 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_dedicated_hosts_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -139,21 +140,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -167,10 +168,11 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}') + _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'), @@ -178,23 +180,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -205,31 +207,32 @@ def build_list_by_host_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -241,10 +244,11 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart") # 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'), @@ -252,21 +256,21 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -306,6 +310,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHost') @@ -315,6 +320,7 @@ def _create_or_update_initial( 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'], @@ -322,7 +328,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -340,7 +350,7 @@ def _create_or_update_initial( 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 @@ -375,8 +385,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -389,6 +400,7 @@ 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 @@ -413,10 +425,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore def _update_initial( self, @@ -432,6 +443,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'DedicatedHostUpdate') @@ -441,6 +453,7 @@ def _update_initial( 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'], @@ -448,7 +461,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -462,7 +479,7 @@ def _update_initial( 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 @@ -497,8 +514,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.DedicatedHost] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] lro_delay = kwargs.pop( 'polling_interval', @@ -511,6 +529,7 @@ 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 @@ -535,12 +554,11 @@ 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) + 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 + 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: str, host_group_name: str, @@ -553,18 +571,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -574,11 +599,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -605,7 +630,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -617,6 +643,7 @@ 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 ) @@ -637,10 +664,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore @distributed_trace def get( @@ -661,7 +687,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_11_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) @@ -674,19 +700,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -700,7 +733,7 @@ def get( 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 @@ -724,6 +757,8 @@ def list_by_host_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.DedicatedHostListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -736,6 +771,7 @@ def prepare_request(next_link=None): 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) @@ -747,6 +783,7 @@ def prepare_request(next_link=None): 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) @@ -764,7 +801,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]: @@ -777,9 +818,9 @@ def get_next(next_link=None): 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 - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -792,18 +833,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_restart_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._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -813,11 +861,11 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart"} # type: ignore @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_group_name: str, @@ -848,7 +896,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -860,6 +909,7 @@ def begin_restart( 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 ) @@ -880,7 +930,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_images_operations.py index 858919de0aac..fb7cc8be8743 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -160,33 +161,34 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,30 +198,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -228,29 +231,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -289,6 +293,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'Image') @@ -297,6 +302,7 @@ def _create_or_update_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'], @@ -304,7 +310,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -322,7 +332,7 @@ def _create_or_update_initial( 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 @@ -353,8 +363,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -366,6 +377,7 @@ 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 @@ -390,10 +402,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore def _update_initial( self, @@ -408,6 +419,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ImageUpdate') @@ -416,6 +428,7 @@ def _update_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'], @@ -423,7 +436,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -441,7 +458,7 @@ def _update_initial( 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 @@ -472,8 +489,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.Image] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] lro_delay = kwargs.pop( 'polling_interval', @@ -485,6 +503,7 @@ 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 @@ -509,12 +528,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -526,17 +544,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -546,11 +571,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, image_name: str, @@ -574,7 +599,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -585,6 +611,7 @@ 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 ) @@ -605,10 +632,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore @distributed_trace def get( @@ -624,7 +650,7 @@ 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) @@ -637,18 +663,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -662,7 +695,7 @@ def get( 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 @@ -680,6 +713,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -691,6 +726,7 @@ def prepare_request(next_link=None): 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) @@ -701,6 +737,7 @@ def prepare_request(next_link=None): 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) @@ -718,7 +755,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]: @@ -731,7 +772,7 @@ def get_next(next_link=None): 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( @@ -746,6 +787,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.ImageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -756,6 +799,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -765,6 +809,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -782,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]: @@ -795,4 +844,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_log_analytics_operations.py index 625c09da5444..b42812fbe65b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_log_analytics_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_export_request_rate_by_interval_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -78,34 +78,34 @@ def build_export_throttled_requests_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -145,6 +145,7 @@ def _export_request_rate_by_interval_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RequestRateByIntervalInput') @@ -152,6 +153,7 @@ def _export_request_rate_by_interval_initial( 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'], @@ -159,7 +161,11 @@ def _export_request_rate_by_interval_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -175,7 +181,7 @@ def _export_request_rate_by_interval_initial( 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 @@ -206,8 +212,9 @@ def begin_export_request_rate_by_interval( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,6 +225,7 @@ 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 @@ -242,10 +250,9 @@ 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) + 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 + 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, @@ -259,6 +266,7 @@ def _export_throttled_requests_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ThrottledRequestsInput') @@ -266,6 +274,7 @@ def _export_throttled_requests_initial( 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'], @@ -273,7 +282,11 @@ def _export_throttled_requests_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -289,7 +302,7 @@ def _export_throttled_requests_initial( 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 @@ -320,8 +333,9 @@ def begin_export_throttled_requests( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.LogAnalyticsOperationResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +346,7 @@ 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 @@ -356,7 +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) + 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 + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_operations.py index 73a016260849..fe95680c0394 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.Compute/operations') + _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') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.ComputeOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,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]: @@ -133,4 +142,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_proximity_placement_groups_operations.py index ff2bd767fa6c..5c0b9a06b9a0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_proximity_placement_groups_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,35 +36,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -80,35 +80,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,31 +121,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,33 +159,34 @@ def build_get_request( include_colocation_status: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -193,29 +195,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -225,30 +228,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -301,6 +305,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroup') @@ -309,6 +314,7 @@ def create_or_update( 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'], @@ -316,7 +322,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -334,7 +344,7 @@ def create_or_update( 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 @@ -364,6 +374,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') @@ -372,6 +383,7 @@ def update( 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'], @@ -379,7 +391,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -393,11 +409,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, proximity_placement_group_name: str, @@ -420,17 +436,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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 +463,7 @@ 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 @@ -458,7 +481,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) @@ -471,18 +494,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -496,7 +526,7 @@ def get( 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 @@ -513,6 +543,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -523,6 +555,7 @@ def prepare_request(next_link=None): 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) @@ -532,6 +565,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -549,7 +583,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]: @@ -562,7 +600,7 @@ def get_next(next_link=None): 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( @@ -581,6 +619,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.ProximityPlacementGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -592,6 +632,7 @@ def prepare_request(next_link=None): 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) @@ -602,6 +643,7 @@ def prepare_request(next_link=None): 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) @@ -619,7 +661,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]: @@ -632,4 +678,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_restore_point_collections_operations.py index be0e4c1acb71..3b8e9c354ecf 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_restore_point_collections_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_delete_request_initial( restore_point_collection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -160,33 +161,34 @@ def build_get_request( expand: Optional[Union[str, "_models.RestorePointCollectionExpandOptions"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -196,30 +198,31 @@ def build_list_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -228,29 +231,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -306,6 +310,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollection') @@ -314,6 +319,7 @@ def create_or_update( 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'], @@ -321,7 +327,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -339,7 +349,7 @@ def create_or_update( 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 @@ -369,6 +379,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePointCollectionUpdate') @@ -377,6 +388,7 @@ def update( 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'], @@ -384,7 +396,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -398,10 +414,10 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -413,17 +429,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -433,11 +456,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -462,7 +485,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -473,6 +497,7 @@ 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 ) @@ -493,10 +518,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore @distributed_trace def get( @@ -513,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_11_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) @@ -526,18 +550,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -551,7 +582,7 @@ def get( 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 @@ -571,6 +602,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -582,6 +615,7 @@ def prepare_request(next_link=None): 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) @@ -592,6 +626,7 @@ def prepare_request(next_link=None): 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) @@ -609,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]: @@ -622,7 +661,7 @@ def get_next(next_link=None): 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( @@ -640,6 +679,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.RestorePointCollectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -650,6 +691,7 @@ def prepare_request(next_link=None): 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) @@ -659,6 +701,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -676,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]: @@ -689,4 +736,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_restore_points_operations.py index 81921beb1cd4..d23ef78e8a81 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_restore_points_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + _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'), @@ -51,23 +51,23 @@ def build_create_request_initial( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -81,10 +81,11 @@ def build_delete_request_initial( restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + _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'), @@ -92,21 +93,21 @@ def build_delete_request_initial( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -120,10 +121,11 @@ def build_get_request( expand: Optional[Union[str, "_models.RestorePointExpandOptions"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}') + _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'), @@ -131,23 +133,23 @@ def build_get_request( "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -187,6 +189,7 @@ def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestorePoint') @@ -196,6 +199,7 @@ def _create_initial( 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'], @@ -203,7 +207,11 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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 [201]: @@ -217,7 +225,7 @@ def _create_initial( 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 @@ -253,8 +261,9 @@ def begin_create( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.RestorePoint] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,6 +276,7 @@ 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 @@ -291,12 +301,11 @@ 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) + 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 + 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: str, restore_point_collection_name: str, @@ -309,18 +318,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -330,11 +346,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -361,7 +377,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -373,6 +390,7 @@ 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 ) @@ -393,10 +411,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore @distributed_trace def get( @@ -416,7 +433,7 @@ def get( :param restore_point_name: The name of the restore point. :type restore_point_name: str :param expand: The expand expression to apply on the operation. 'InstanceView' retrieves - information about the run-time state of a restore point. + information about the run-time state of a restore point. Default value is None. :type expand: str or ~azure.mgmt.compute.v2021_11_01.models.RestorePointExpandOptions :keyword callable cls: A custom type or function that will be passed the direct response :return: RestorePoint, or the result of cls(response) @@ -429,19 +446,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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, expand=expand, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -455,5 +479,5 @@ def get( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_ssh_public_keys_operations.py index c9d226e72693..c0fe2551c7ad 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_ssh_public_keys_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +31,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,30 +64,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -100,35 +102,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -144,35 +146,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -185,31 +187,32 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -220,31 +223,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -255,31 +259,32 @@ def build_generate_key_pair_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -320,6 +325,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -330,6 +337,7 @@ def prepare_request(next_link=None): 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) @@ -339,6 +347,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -356,7 +365,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]: @@ -369,7 +382,7 @@ def get_next(next_link=None): 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( @@ -389,6 +402,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.SshPublicKeysGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -400,6 +415,7 @@ def prepare_request(next_link=None): 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) @@ -410,6 +426,7 @@ def prepare_request(next_link=None): 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) @@ -427,7 +444,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 +461,7 @@ def get_next(next_link=None): 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( @@ -469,6 +490,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyResource') @@ -477,6 +499,7 @@ def create( 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'], @@ -484,7 +507,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -502,7 +529,7 @@ def create( 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 @@ -532,6 +559,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') @@ -540,6 +568,7 @@ def update( 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'], @@ -547,7 +576,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -561,11 +594,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, ssh_public_key_name: str, @@ -588,17 +621,24 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -608,7 +648,7 @@ 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 @@ -635,17 +675,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -659,7 +706,7 @@ def get( 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 @@ -688,17 +735,24 @@ def generate_key_pair( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -712,5 +766,5 @@ def generate_key_pair( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_usage_operations.py index e7ce4f97cebb..0daa86de2cc6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_usage_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_usage_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,6 +97,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.ListUsagesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -107,6 +110,7 @@ def prepare_request(next_link=None): 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) @@ -117,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -134,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]: @@ -147,4 +156,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_extension_images_operations.py index ac25c3fc6bd1..ac1fe3e4d2f6 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_extension_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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}') + _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'), @@ -45,21 +46,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,31 +71,32 @@ def build_list_types_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_list_versions_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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'), @@ -121,27 +124,27 @@ def build_list_versions_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,6 +200,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_get_request( location=location, @@ -204,12 +209,17 @@ def get( 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(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]: @@ -223,7 +233,7 @@ def get( 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 @@ -250,17 +260,24 @@ def list_types( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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]: @@ -274,7 +291,7 @@ def list_types( 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 @@ -296,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) @@ -313,12 +330,15 @@ def list_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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, @@ -327,7 +347,11 @@ def list_versions( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -341,5 +365,5 @@ def list_versions( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_extensions_operations.py index 1dff12be868e..dd94c6607a65 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -51,23 +51,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -84,12 +84,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -97,23 +97,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -127,10 +127,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -138,21 +139,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,10 +167,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}') + _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'), @@ -177,23 +179,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -206,33 +208,34 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -272,6 +275,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtension') @@ -281,6 +285,7 @@ def _create_or_update_initial( 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'], @@ -288,7 +293,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -306,7 +315,7 @@ def _create_or_update_initial( 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 @@ -344,8 +353,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -358,6 +368,7 @@ 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 @@ -382,10 +393,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore def _update_initial( self, @@ -401,6 +411,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') @@ -410,6 +421,7 @@ def _update_initial( 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'], @@ -417,7 +429,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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,7 +447,7 @@ def _update_initial( 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 @@ -469,8 +485,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -483,6 +500,7 @@ 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 @@ -507,12 +525,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -525,18 +542,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, vm_extension_name=vm_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -546,11 +570,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -577,7 +601,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -589,6 +614,7 @@ 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 ) @@ -609,10 +635,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -631,7 +656,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) @@ -644,19 +669,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -670,7 +702,7 @@ def get( 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 @@ -687,7 +719,7 @@ 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) @@ -700,18 +732,25 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -725,5 +764,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_images_edge_zone_operations.py index 9ce0dd8cf97e..f7a90894ef20 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_images_edge_zone_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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}') + _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'), @@ -49,21 +50,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -81,10 +82,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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'), @@ -94,27 +96,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -126,10 +128,11 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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'), @@ -137,21 +140,21 @@ def build_list_offers_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,31 +165,32 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,10 +203,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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'), @@ -211,21 +216,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -287,6 +292,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_get_request( location=location, @@ -296,12 +303,17 @@ def get( 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(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]: @@ -315,7 +327,7 @@ def get( 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 @@ -344,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) @@ -362,6 +375,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_list_request( location=location, @@ -370,6 +385,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -378,7 +394,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -392,7 +412,7 @@ def list( 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 @@ -423,18 +443,25 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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]: @@ -448,7 +475,7 @@ def list_offers( 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 @@ -475,17 +502,24 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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 +533,7 @@ def list_publishers( 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 @@ -533,6 +567,8 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_list_skus_request( location=location, @@ -540,12 +576,17 @@ def list_skus( 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(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]: @@ -559,5 +600,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_images_operations.py index 5ec6a2b7b768..6816673bd35e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_images_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from 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 @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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}') + _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'), @@ -47,21 +48,21 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_list_request( orderby: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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'), @@ -90,27 +92,27 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if expand is not None: - query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') + _query_parameters['$expand'] = _SERIALIZER.query("expand", expand, 'str') if top is not None: - query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,31 +123,32 @@ def build_list_offers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,30 +158,31 @@ def build_list_publishers_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,10 +194,11 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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'), @@ -201,21 +206,21 @@ def build_list_skus_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -274,6 +279,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_get_request( location=location, @@ -282,12 +289,17 @@ def get( 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(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]: @@ -301,7 +313,7 @@ def get( 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 @@ -327,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) @@ -344,6 +356,8 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_list_request( location=location, @@ -351,6 +365,7 @@ def list( offer=offer, skus=skus, subscription_id=self._config.subscription_id, + api_version=api_version, expand=expand, top=top, orderby=orderby, @@ -359,7 +374,11 @@ def list( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -373,7 +392,7 @@ def list( 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 @@ -400,17 +419,24 @@ def list_offers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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]: @@ -424,7 +450,7 @@ def list_offers( 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 @@ -448,16 +474,23 @@ def list_publishers( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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]: @@ -471,7 +504,7 @@ def list_publishers( 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 @@ -501,18 +534,25 @@ def list_skus( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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(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,5 +566,5 @@ def list_skus( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_run_commands_operations.py index 941a202e0aa6..4f606f1c303b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,31 +69,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -107,12 +109,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -120,23 +122,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -153,12 +155,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}') + _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'), @@ -166,23 +168,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -196,10 +198,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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}') + _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'), @@ -207,21 +210,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -235,10 +238,11 @@ def build_get_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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}') + _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'), @@ -246,23 +250,23 @@ def build_get_by_virtual_machine_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -275,33 +279,34 @@ def build_list_by_virtual_machine_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -344,6 +349,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.RunCommandListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -355,6 +362,7 @@ def prepare_request(next_link=None): 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) @@ -365,6 +373,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -382,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]: @@ -395,7 +408,7 @@ def get_next(next_link=None): 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( @@ -421,17 +434,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -445,7 +465,7 @@ def get( 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( @@ -454,6 +474,8 @@ 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"] @@ -462,7 +484,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -471,6 +493,7 @@ def _create_or_update_initial( 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'], @@ -478,7 +501,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -496,7 +523,7 @@ def _create_or_update_initial( 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 @@ -506,6 +533,8 @@ def begin_create_or_update( 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. @@ -519,6 +548,9 @@ 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_11_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 @@ -533,8 +565,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -548,6 +580,7 @@ def begin_create_or_update( 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 ) @@ -571,10 +604,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore def _update_initial( self, @@ -582,6 +614,8 @@ 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"] @@ -590,7 +624,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -599,6 +633,7 @@ def _update_initial( 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'], @@ -606,7 +641,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +659,7 @@ def _update_initial( 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 @@ -630,6 +669,8 @@ def begin_update( 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. @@ -642,6 +683,9 @@ 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_11_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 @@ -656,8 +700,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -671,6 +715,7 @@ def begin_update( 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 ) @@ -694,12 +739,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -712,18 +756,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -733,11 +784,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -764,7 +815,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -776,6 +828,7 @@ 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 ) @@ -796,10 +849,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get_by_virtual_machine( @@ -818,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) @@ -831,19 +883,26 @@ def get_by_virtual_machine( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -857,7 +916,7 @@ def get_by_virtual_machine( 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 @@ -874,7 +933,7 @@ 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 @@ -883,6 +942,8 @@ def list_by_virtual_machine( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -895,6 +956,7 @@ def prepare_request(next_link=None): 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'], ) @@ -907,6 +969,7 @@ def prepare_request(next_link=None): 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, ) @@ -925,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]: @@ -938,4 +1005,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_extensions_operations.py index 9de536ed6d06..abfc03b12e5a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -52,23 +52,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -85,12 +85,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -98,23 +98,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -128,10 +128,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -139,21 +140,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -167,10 +168,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}') + _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'), @@ -178,23 +180,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -205,31 +207,32 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -269,6 +272,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') @@ -278,6 +282,7 @@ def _create_or_update_initial( 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'], @@ -285,7 +290,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -303,7 +312,7 @@ def _create_or_update_initial( 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 @@ -342,8 +351,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -356,6 +366,7 @@ 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 @@ -380,10 +391,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore def _update_initial( self, @@ -399,6 +409,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') @@ -408,6 +419,7 @@ def _update_initial( 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'], @@ -415,7 +427,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -433,7 +449,7 @@ def _update_initial( 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 @@ -471,8 +487,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -485,6 +502,7 @@ 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 @@ -509,12 +527,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -527,18 +544,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, vmss_extension_name=vmss_extension_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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,11 +572,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -579,7 +603,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -591,6 +616,7 @@ 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 ) @@ -611,10 +637,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore @distributed_trace def get( @@ -633,7 +658,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) @@ -646,19 +671,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -672,7 +704,7 @@ def get( 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 @@ -695,6 +727,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetExtensionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -707,6 +741,7 @@ def prepare_request(next_link=None): 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) @@ -718,6 +753,7 @@ def prepare_request(next_link=None): 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) @@ -735,7 +771,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]: @@ -748,4 +788,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py index 4dbcf75cebf7..ffd6cdda70e7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,31 +33,32 @@ def build_cancel_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -68,31 +69,32 @@ def build_start_os_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -103,31 +105,32 @@ def build_start_extension_upgrade_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -138,31 +141,32 @@ def build_get_latest_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -188,7 +192,7 @@ 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: str, vm_scale_set_name: str, @@ -200,17 +204,24 @@ def _cancel_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_cancel_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._cancel_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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,11 +231,11 @@ 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 @distributed_trace - def begin_cancel( + def begin_cancel( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -248,7 +259,8 @@ def begin_cancel( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -259,6 +271,7 @@ 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 ) @@ -279,12 +292,11 @@ 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) + 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 + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore - def _start_os_upgrade_initial( + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -296,17 +308,24 @@ def _start_os_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_start_os_upgrade_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -316,11 +335,11 @@ 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 @distributed_trace - def begin_start_os_upgrade( + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -346,7 +365,8 @@ def begin_start_os_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,6 +377,7 @@ 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 ) @@ -377,12 +398,11 @@ 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) + 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 + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore - def _start_extension_upgrade_initial( + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -394,17 +414,24 @@ def _start_extension_upgrade_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -414,11 +441,11 @@ 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 @distributed_trace - def begin_start_extension_upgrade( + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -444,7 +471,8 @@ def begin_start_extension_upgrade( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -455,6 +483,7 @@ 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 ) @@ -475,10 +504,9 @@ 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) + 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 + begin_start_extension_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore @distributed_trace def get_latest( @@ -504,17 +532,24 @@ def get_latest( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -528,5 +563,5 @@ def get_latest( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py index a2e97c9eb188..11cbf836579b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from 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 @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -53,23 +53,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -87,12 +87,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}') + _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'), @@ -101,23 +101,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -132,10 +132,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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}') + _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'), @@ -144,21 +145,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -173,10 +174,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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}') + _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'), @@ -185,23 +187,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -215,10 +217,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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'), @@ -226,23 +229,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -283,6 +286,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') @@ -293,6 +297,7 @@ def _create_or_update_initial( 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'], @@ -300,7 +305,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -318,7 +327,7 @@ def _create_or_update_initial( 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 @@ -359,8 +368,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -374,6 +384,7 @@ 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 @@ -398,10 +409,9 @@ 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) + 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 + 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, @@ -418,6 +428,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') @@ -428,6 +439,7 @@ def _update_initial( 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'], @@ -435,7 +447,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -449,7 +465,7 @@ def _update_initial( 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 @@ -490,8 +506,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetVMExtension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] lro_delay = kwargs.pop( 'polling_interval', @@ -505,6 +522,7 @@ 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 @@ -529,12 +547,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -548,6 +565,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -555,12 +574,17 @@ def _delete_initial( 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) - 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]: @@ -570,11 +594,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -604,7 +628,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -617,6 +642,7 @@ 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 ) @@ -637,10 +663,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore @distributed_trace def get( @@ -662,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) @@ -675,6 +700,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -682,13 +709,18 @@ def get( 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) - 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]: @@ -702,7 +734,7 @@ def get( 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 @@ -722,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) @@ -735,19 +767,26 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -761,5 +800,5 @@ def list( 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py index 3a82c91cde3b..e1d4b722239a 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -40,12 +40,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -54,23 +54,23 @@ def build_create_or_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,12 +88,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}') + _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'), @@ -102,23 +102,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -133,10 +133,11 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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}') + _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'), @@ -145,21 +146,21 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -174,10 +175,11 @@ def build_get_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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}') + _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'), @@ -186,23 +188,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -216,10 +218,11 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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'), @@ -227,23 +230,23 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -276,6 +279,8 @@ 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"] @@ -284,7 +289,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommand') @@ -294,6 +299,7 @@ def _create_or_update_initial( 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'], @@ -301,7 +307,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -319,7 +329,7 @@ def _create_or_update_initial( 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 @@ -330,6 +340,8 @@ def begin_create_or_update( 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. @@ -344,6 +356,9 @@ 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_11_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 @@ -358,8 +373,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -374,6 +389,7 @@ def begin_create_or_update( 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 ) @@ -397,10 +413,9 @@ 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) + 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 + 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, @@ -409,6 +424,8 @@ 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"] @@ -417,7 +434,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') @@ -427,6 +444,7 @@ def _update_initial( 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'], @@ -434,7 +452,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -448,7 +470,7 @@ def _update_initial( 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 @@ -459,6 +481,8 @@ def begin_update( 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. @@ -473,6 +497,9 @@ 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_11_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 @@ -487,8 +514,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommand] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -503,6 +530,7 @@ def begin_update( 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 ) @@ -526,12 +554,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -545,6 +572,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, @@ -552,12 +581,17 @@ def _delete_initial( 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) - 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]: @@ -567,11 +601,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -601,7 +635,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -614,6 +649,7 @@ 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 ) @@ -634,10 +670,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore @distributed_trace def get( @@ -659,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) @@ -672,6 +707,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, @@ -679,13 +716,18 @@ def get( 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) - 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]: @@ -699,7 +741,7 @@ def get( 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 @@ -719,7 +761,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: An iterator like instance of either VirtualMachineRunCommandsListResult or the result @@ -728,6 +770,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineRunCommandsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -741,6 +785,7 @@ def prepare_request(next_link=None): 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'], ) @@ -754,6 +799,7 @@ def prepare_request(next_link=None): 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, ) @@ -772,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]: @@ -785,4 +835,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_vms_operations.py index 8249aa9da878..f4ddaebcfcd8 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_set_vms_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage') + _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'), @@ -52,23 +52,23 @@ def build_reimage_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,10 +82,11 @@ def build_reimage_all_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall') + _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'), @@ -93,21 +94,21 @@ def build_reimage_all_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -119,10 +120,11 @@ def build_deallocate_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate') + _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'), @@ -130,21 +132,21 @@ def build_deallocate_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -159,12 +161,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}') + _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'), @@ -172,23 +174,23 @@ def build_update_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -204,10 +206,11 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}') + _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'), @@ -215,23 +218,23 @@ def build_delete_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -245,10 +248,11 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}') + _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'), @@ -256,23 +260,23 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -284,10 +288,11 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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'), @@ -295,21 +300,21 @@ def build_get_instance_view_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -324,37 +329,38 @@ def build_list_request( expand: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if select is not None: - query_parameters['$select'] = _SERIALIZER.query("select", select, 'str') + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -368,10 +374,11 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff') + _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'), @@ -379,23 +386,23 @@ def build_power_off_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -407,10 +414,11 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart') + _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'), @@ -418,21 +426,21 @@ def build_restart_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -444,10 +452,11 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start') + _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'), @@ -455,21 +464,21 @@ def build_start_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -481,10 +490,11 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy') + _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'), @@ -492,21 +502,21 @@ def build_redeploy_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -520,10 +530,11 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-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') + _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'), @@ -531,23 +542,23 @@ def build_retrieve_boot_diagnostics_data_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -559,10 +570,11 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance') + _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'), @@ -570,21 +582,21 @@ def build_perform_maintenance_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -596,10 +608,11 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction') + _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'), @@ -607,21 +620,21 @@ def build_simulate_eviction_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -636,12 +649,12 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand') + _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'), @@ -649,29 +662,29 @@ def build_run_command_request_initial( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetVMsOperations(object): +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 @@ -693,7 +706,7 @@ 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: str, vm_scale_set_name: str, @@ -707,6 +720,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_vm_reimage_input is not None: @@ -719,6 +733,7 @@ def _reimage_initial( 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'], @@ -726,7 +741,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -736,11 +755,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -757,6 +776,7 @@ 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. + Default value is None. :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetVMReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -771,8 +791,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -785,6 +806,7 @@ 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 @@ -806,12 +828,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -824,18 +845,25 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_reimage_all_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._reimage_all_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -845,11 +873,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -877,7 +905,8 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -889,6 +918,7 @@ 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 ) @@ -909,12 +939,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -927,18 +956,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_deallocate_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._deallocate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -948,11 +984,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -981,7 +1017,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -993,6 +1030,7 @@ 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 ) @@ -1013,10 +1051,9 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate"} # type: ignore def _update_initial( self, @@ -1032,6 +1069,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') @@ -1041,6 +1079,7 @@ def _update_initial( 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'], @@ -1048,7 +1087,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1066,7 +1109,7 @@ def _update_initial( 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 @@ -1103,8 +1146,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetVM] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] lro_delay = kwargs.pop( 'polling_interval', @@ -1117,6 +1161,7 @@ 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 @@ -1141,12 +1186,11 @@ 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) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1160,19 +1204,26 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -1182,11 +1233,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1203,7 +1254,7 @@ 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. @@ -1217,7 +1268,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1230,6 +1282,7 @@ 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 ) @@ -1250,10 +1303,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}"} # type: ignore @distributed_trace def get( @@ -1274,7 +1326,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_11_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) @@ -1287,19 +1339,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -1313,7 +1372,7 @@ def get( 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 @@ -1343,18 +1402,25 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -1368,7 +1434,7 @@ def get_instance_view( 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 @@ -1389,12 +1455,13 @@ 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 @@ -1403,6 +1470,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetVMListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1415,6 +1484,7 @@ def prepare_request(next_link=None): 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, @@ -1429,6 +1499,7 @@ def prepare_request(next_link=None): 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, @@ -1449,7 +1520,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]: @@ -1462,9 +1537,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -1478,19 +1553,26 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -1500,11 +1582,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1524,7 +1606,7 @@ 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. @@ -1538,7 +1620,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1551,6 +1634,7 @@ 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 ) @@ -1571,12 +1655,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1589,18 +1672,25 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_restart_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1610,11 +1700,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1641,7 +1731,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1653,6 +1744,7 @@ 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 ) @@ -1673,12 +1765,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1691,18 +1782,25 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1712,11 +1810,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1743,7 +1841,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1755,6 +1854,7 @@ 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 ) @@ -1775,12 +1875,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1793,18 +1892,25 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_redeploy_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._redeploy_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1814,11 +1920,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1846,7 +1952,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1858,6 +1965,7 @@ 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 ) @@ -1878,10 +1986,9 @@ 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) + 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 + 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( @@ -1903,7 +2010,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) @@ -1916,19 +2023,26 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-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) - 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]: @@ -1942,10 +2056,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1958,18 +2072,25 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_perform_maintenance_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, instance_id=instance_id, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._perform_maintenance_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1979,11 +2100,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2010,7 +2131,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2022,6 +2144,7 @@ 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 ) @@ -2042,13 +2165,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2074,18 +2196,25 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -2095,7 +2224,7 @@ 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( @@ -2104,6 +2233,8 @@ 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"]] @@ -2112,7 +2243,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -2121,6 +2252,7 @@ def _run_command_initial( 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'], @@ -2128,7 +2260,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2144,7 +2280,7 @@ def _run_command_initial( 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 @@ -2154,6 +2290,8 @@ def begin_run_command( 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. @@ -2166,6 +2304,9 @@ def begin_run_command( :type instance_id: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_11_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 @@ -2179,8 +2320,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -2194,6 +2335,7 @@ def begin_run_command( instance_id=instance_id, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -2217,7 +2359,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_sets_operations.py index f510a7a7ac6b..3648c9d721d2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_scale_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -158,33 +159,34 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,33 +199,34 @@ def build_get_request( expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -237,35 +240,35 @@ def build_deallocate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -282,37 +285,37 @@ def build_delete_instances_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -325,31 +328,32 @@ def build_get_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -359,30 +363,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -391,29 +396,30 @@ def build_list_all_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -424,31 +430,32 @@ def build_list_skus_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -459,31 +466,32 @@ def build_get_os_upgrade_history_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -498,37 +506,37 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -544,35 +552,35 @@ def build_restart_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -588,35 +596,35 @@ def build_start_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -632,35 +640,35 @@ def build_redeploy_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -676,35 +684,35 @@ def build_perform_maintenance_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -720,35 +728,35 @@ def build_update_instances_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -764,35 +772,35 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -808,35 +816,35 @@ def build_reimage_all_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -853,36 +861,37 @@ def build_force_recovery_service_fabric_platform_update_domain_walk_request( placement_group_id: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk') + _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) + _url = _format_url_section(_url, **path_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') + _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') if zone is not None: - query_parameters['zone'] = _SERIALIZER.query("zone", zone, 'str') + _query_parameters['zone'] = _SERIALIZER.query("zone", zone, 'str') if placement_group_id is not None: - query_parameters['placementGroupId'] = _SERIALIZER.query("placement_group_id", placement_group_id, 'str') + _query_parameters['placementGroupId'] = _SERIALIZER.query("placement_group_id", placement_group_id, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -896,35 +905,35 @@ def build_convert_to_single_placement_group_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -940,41 +949,41 @@ def build_set_orchestration_service_state_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachineScaleSetsOperations(object): +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 @@ -1013,6 +1022,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1024,6 +1035,7 @@ def prepare_request(next_link=None): 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) @@ -1034,6 +1046,7 @@ def prepare_request(next_link=None): 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) @@ -1051,7 +1064,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]: @@ -1064,7 +1081,7 @@ def get_next(next_link=None): 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, @@ -1079,6 +1096,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSet') @@ -1087,6 +1105,7 @@ def _create_or_update_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'], @@ -1094,7 +1113,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1112,7 +1135,7 @@ def _create_or_update_initial( 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 @@ -1145,8 +1168,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1158,6 +1182,7 @@ 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 @@ -1182,10 +1207,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore def _update_initial( self, @@ -1200,6 +1224,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') @@ -1208,6 +1233,7 @@ def _update_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'], @@ -1215,7 +1241,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1229,7 +1259,7 @@ def _update_initial( 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 @@ -1262,8 +1292,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -1275,6 +1306,7 @@ 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 @@ -1299,12 +1331,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1317,18 +1348,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, vm_scale_set_name=vm_scale_set_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1338,11 +1376,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1356,6 +1394,7 @@ 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. @@ -1369,7 +1408,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1381,6 +1421,7 @@ 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 ) @@ -1401,10 +1442,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore @distributed_trace def get( @@ -1422,7 +1462,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_11_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) @@ -1435,18 +1475,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -1460,10 +1507,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore - def _deallocate_initial( + def _deallocate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1476,6 +1523,7 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -1487,6 +1535,7 @@ def _deallocate_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'], @@ -1494,7 +1543,11 @@ def _deallocate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1504,11 +1557,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1523,7 +1576,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -1538,8 +1592,9 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1551,6 +1606,7 @@ 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 @@ -1572,12 +1628,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -1591,6 +1646,7 @@ def _delete_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -1599,6 +1655,7 @@ def _delete_instances_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, @@ -1607,7 +1664,11 @@ def _delete_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1617,11 +1678,11 @@ 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 @distributed_trace - def begin_delete_instances( + def begin_delete_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -1639,7 +1700,7 @@ def begin_delete_instances( :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_11_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. @@ -1653,8 +1714,9 @@ def begin_delete_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1667,6 +1729,7 @@ 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 @@ -1688,10 +1751,9 @@ 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) + 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 + begin_delete_instances.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore @distributed_trace def get_instance_view( @@ -1717,17 +1779,24 @@ def get_instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -1741,7 +1810,7 @@ def get_instance_view( 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 @@ -1761,6 +1830,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1772,6 +1843,7 @@ def prepare_request(next_link=None): 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) @@ -1782,6 +1854,7 @@ def prepare_request(next_link=None): 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) @@ -1799,7 +1872,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]: @@ -1812,7 +1889,7 @@ def get_next(next_link=None): 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( @@ -1830,6 +1907,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetListWithLinkResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1840,6 +1919,7 @@ def prepare_request(next_link=None): 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) @@ -1849,6 +1929,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1866,7 +1947,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]: @@ -1879,7 +1964,7 @@ def get_next(next_link=None): 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( @@ -1902,6 +1987,8 @@ def list_skus( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetListSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1914,6 +2001,7 @@ def prepare_request(next_link=None): 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) @@ -1925,6 +2013,7 @@ def prepare_request(next_link=None): 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) @@ -1942,7 +2031,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]: @@ -1955,7 +2048,7 @@ def get_next(next_link=None): 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( @@ -1977,6 +2070,8 @@ def get_os_upgrade_history( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineScaleSetListOSUpgradeHistory] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1989,6 +2084,7 @@ def prepare_request(next_link=None): 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) @@ -2000,6 +2096,7 @@ def prepare_request(next_link=None): 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) @@ -2017,7 +2114,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]: @@ -2030,9 +2131,9 @@ def get_next(next_link=None): 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: str, vm_scale_set_name: str, @@ -2046,6 +2147,7 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2057,6 +2159,7 @@ def _power_off_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, @@ -2065,7 +2168,11 @@ def _power_off_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2075,11 +2182,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2097,9 +2204,10 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2114,8 +2222,9 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2128,6 +2237,7 @@ 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 @@ -2149,12 +2259,11 @@ 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) + 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 + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2167,6 +2276,7 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2178,6 +2288,7 @@ def _restart_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'], @@ -2185,7 +2296,11 @@ def _restart_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2195,11 +2310,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2212,7 +2327,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2227,8 +2343,9 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2240,6 +2357,7 @@ 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 @@ -2261,12 +2379,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2279,6 +2396,7 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2290,6 +2408,7 @@ def _start_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'], @@ -2297,7 +2416,11 @@ def _start_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2307,11 +2430,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2324,7 +2447,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2339,8 +2463,9 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2352,6 +2477,7 @@ 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 @@ -2373,12 +2499,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2391,6 +2516,7 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2402,6 +2528,7 @@ def _redeploy_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'], @@ -2409,7 +2536,11 @@ def _redeploy_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2419,11 +2550,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2437,7 +2568,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2452,8 +2584,9 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2465,6 +2598,7 @@ 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 @@ -2486,12 +2620,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2504,6 +2637,7 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2515,6 +2649,7 @@ def _perform_maintenance_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'], @@ -2522,7 +2657,11 @@ def _perform_maintenance_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2532,11 +2671,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2552,7 +2691,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2567,8 +2707,9 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2580,6 +2721,7 @@ 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 @@ -2601,12 +2743,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2619,6 +2760,7 @@ def _update_instances_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') @@ -2627,6 +2769,7 @@ def _update_instances_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'], @@ -2634,7 +2777,11 @@ def _update_instances_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2644,11 +2791,11 @@ 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 @distributed_trace - def begin_update_instances( + def begin_update_instances( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2676,8 +2823,9 @@ def begin_update_instances( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2689,6 +2837,7 @@ 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 @@ -2710,12 +2859,11 @@ 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) + 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 + 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: str, vm_scale_set_name: str, @@ -2728,6 +2876,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_scale_set_reimage_input is not None: @@ -2739,6 +2888,7 @@ def _reimage_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'], @@ -2746,7 +2896,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2756,11 +2910,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2775,7 +2929,7 @@ 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. + :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_11_01.models.VirtualMachineScaleSetReimageParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -2790,8 +2944,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2803,6 +2958,7 @@ 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 @@ -2824,12 +2980,11 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore - def _reimage_all_initial( + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2842,6 +2997,7 @@ def _reimage_all_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if vm_instance_i_ds is not None: @@ -2853,6 +3009,7 @@ def _reimage_all_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'], @@ -2860,7 +3017,11 @@ def _reimage_all_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2870,11 +3031,11 @@ 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 @distributed_trace - def begin_reimage_all( + def begin_reimage_all( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -2888,7 +3049,8 @@ 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. + :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_11_01.models.VirtualMachineScaleSetVMInstanceIDs :keyword callable cls: A custom type or function that will be passed the direct response @@ -2903,8 +3065,9 @@ def begin_reimage_all( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2916,6 +3079,7 @@ 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 @@ -2937,10 +3101,9 @@ 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) + 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 + 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( @@ -2963,10 +3126,10 @@ def force_recovery_service_fabric_platform_update_domain_walk( requested. :type platform_update_domain: int :param zone: The zone in which the manual recovery walk is requested for cross zone virtual - machine scale set. + machine scale set. Default value is None. :type zone: str :param placement_group_id: The placement group id for which the manual recovery walk is - requested. + requested. Default value is None. :type placement_group_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RecoveryWalkResponse, or the result of cls(response) @@ -2979,11 +3142,14 @@ def force_recovery_service_fabric_platform_update_domain_walk( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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, zone=zone, placement_group_id=placement_group_id, @@ -2992,7 +3158,11 @@ def force_recovery_service_fabric_platform_update_domain_walk( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3006,11 +3176,11 @@ def force_recovery_service_fabric_platform_update_domain_walk( return deserialized - force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + 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( + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -3037,6 +3207,7 @@ def convert_to_single_placement_group( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') @@ -3045,6 +3216,7 @@ def convert_to_single_placement_group( 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'], @@ -3052,7 +3224,11 @@ def convert_to_single_placement_group( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3062,10 +3238,10 @@ 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: str, vm_scale_set_name: str, @@ -3078,6 +3254,7 @@ def _set_orchestration_service_state_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') @@ -3086,6 +3263,7 @@ def _set_orchestration_service_state_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'], @@ -3093,7 +3271,11 @@ def _set_orchestration_service_state_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3103,11 +3285,11 @@ 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 @distributed_trace - def begin_set_orchestration_service_state( + def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_scale_set_name: str, @@ -3134,8 +3316,9 @@ def begin_set_orchestration_service_state( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -3147,6 +3330,7 @@ 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 @@ -3168,7 +3352,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) + 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 + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_sizes_operations.py index e54270a74d68..2eef98032797 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machine_sizes_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -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 @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -98,6 +99,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -109,6 +112,7 @@ def prepare_request(next_link=None): 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) @@ -119,6 +123,7 @@ def prepare_request(next_link=None): request = build_list_request( location=location, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -136,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]: @@ -149,4 +158,4 @@ def get_next(next_link=None): 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/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machines_operations.py index b55ff1703a49..5875364c3d31 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/operations/_virtual_machines_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_11_01/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,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,30 +34,31 @@ def build_list_by_location_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,35 +72,35 @@ def build_capture_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,35 +116,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -159,35 +160,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -202,33 +203,34 @@ def build_delete_request_initial( force_deletion: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -241,33 +243,34 @@ def build_get_request( expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -278,31 +281,32 @@ def build_instance_view_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -313,31 +317,32 @@ def build_convert_to_managed_disks_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -350,33 +355,34 @@ def build_deallocate_request_initial( hibernate: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _query_parameters['hibernate'] = _SERIALIZER.query("hibernate", hibernate, 'bool') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -387,31 +393,32 @@ def build_generalize_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -423,32 +430,33 @@ def build_list_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, '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') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -460,33 +468,34 @@ def build_list_all_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines') + _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) + _url = _format_url_section(_url, **path_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 = 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') + _query_parameters['statusOnly'] = _SERIALIZER.query("status_only", status_only, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -497,31 +506,32 @@ def build_list_available_sizes_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -534,33 +544,34 @@ def build_power_off_request_initial( skip_shutdown: Optional[bool] = False, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -571,31 +582,32 @@ def build_reapply_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -606,31 +618,32 @@ def build_restart_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -641,31 +654,32 @@ def build_start_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -676,31 +690,32 @@ def build_redeploy_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -714,35 +729,35 @@ def build_reimage_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -757,33 +772,34 @@ def build_retrieve_boot_diagnostics_data_request( sas_uri_expiration_time_in_minutes: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData') + _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) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -794,31 +810,32 @@ def build_perform_maintenance_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -829,31 +846,32 @@ def build_simulate_eviction_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -864,31 +882,32 @@ def build_assess_patches_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-01" + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -902,35 +921,35 @@ def build_install_patches_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -946,41 +965,41 @@ def build_run_command_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-01" accept = "application/json, text/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand') + _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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class VirtualMachinesOperations(object): +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 @@ -1019,6 +1038,8 @@ def list_by_location( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1030,6 +1051,7 @@ def prepare_request(next_link=None): 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) @@ -1040,6 +1062,7 @@ def prepare_request(next_link=None): 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) @@ -1057,7 +1080,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]: @@ -1070,7 +1097,7 @@ def get_next(next_link=None): 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, @@ -1085,6 +1112,7 @@ def _capture_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') @@ -1093,6 +1121,7 @@ def _capture_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'], @@ -1100,7 +1129,11 @@ def _capture_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1116,7 +1149,7 @@ def _capture_initial( 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 @@ -1150,8 +1183,9 @@ def begin_capture( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineCaptureResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1163,6 +1197,7 @@ 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 @@ -1187,10 +1222,9 @@ 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) + 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 + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore def _create_or_update_initial( self, @@ -1205,6 +1239,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachine') @@ -1213,6 +1248,7 @@ def _create_or_update_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'], @@ -1220,7 +1256,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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, 201]: @@ -1238,7 +1278,7 @@ def _create_or_update_initial( 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 @@ -1271,8 +1311,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1284,6 +1325,7 @@ 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 @@ -1308,10 +1350,9 @@ 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) + 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 + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore def _update_initial( self, @@ -1326,6 +1367,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'VirtualMachineUpdate') @@ -1334,6 +1376,7 @@ def _update_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'], @@ -1341,7 +1384,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1355,7 +1402,7 @@ def _update_initial( 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 @@ -1387,8 +1434,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachine] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] lro_delay = kwargs.pop( 'polling_interval', @@ -1400,6 +1448,7 @@ 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 @@ -1424,12 +1473,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1442,18 +1490,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -1463,11 +1518,11 @@ 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 @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1480,7 +1535,8 @@ 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. @@ -1494,7 +1550,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1506,6 +1563,7 @@ 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 ) @@ -1526,10 +1584,9 @@ 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) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore @distributed_trace def get( @@ -1549,6 +1606,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_11_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) @@ -1561,18 +1619,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -1586,7 +1651,7 @@ def get( 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 @@ -1613,17 +1678,24 @@ def instance_view( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -1637,10 +1709,10 @@ def instance_view( return deserialized - instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore - def _convert_to_managed_disks_initial( + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1652,17 +1724,24 @@ def _convert_to_managed_disks_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + request = build_convert_to_managed_disks_request_initial( resource_group_name=resource_group_name, vm_name=vm_name, subscription_id=self._config.subscription_id, + 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) - 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]: @@ -1672,11 +1751,11 @@ 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 @distributed_trace - def begin_convert_to_managed_disks( + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1701,7 +1780,8 @@ def begin_convert_to_managed_disks( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1712,6 +1792,7 @@ 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 ) @@ -1732,12 +1813,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -1750,18 +1830,25 @@ def _deallocate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -1771,11 +1858,11 @@ 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 @distributed_trace - def begin_deallocate( + def begin_deallocate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1790,6 +1877,7 @@ 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. @@ -1803,7 +1891,8 @@ def begin_deallocate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1815,6 +1904,7 @@ 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 ) @@ -1835,13 +1925,12 @@ 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) + 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 + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore @distributed_trace - def generalize( + def generalize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -1869,17 +1958,24 @@ def generalize( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -1889,7 +1985,7 @@ 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 @@ -1907,6 +2003,7 @@ def list( :param filter: The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualMachineListResult or the result of @@ -1915,6 +2012,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1926,6 +2025,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -1937,6 +2037,7 @@ def prepare_request(next_link=None): request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -1955,7 +2056,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]: @@ -1968,7 +2073,7 @@ def get_next(next_link=None): 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( @@ -1981,11 +2086,12 @@ 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 :param filter: The system query option to filter VMs returned in the response. Allowed value is 'virtualMachineScaleSet/id' eq /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VirtualMachineListResult or the result of @@ -1994,6 +2100,8 @@ def list_all( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -2004,6 +2112,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, filter=filter, template_url=self.list_all.metadata['url'], @@ -2015,6 +2124,7 @@ def prepare_request(next_link=None): request = build_list_all_request( subscription_id=self._config.subscription_id, + api_version=api_version, status_only=status_only, filter=filter, template_url=next_link, @@ -2034,7 +2144,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]: @@ -2047,7 +2161,7 @@ def get_next(next_link=None): 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( @@ -2070,6 +2184,8 @@ def list_available_sizes( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineSizeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -2082,6 +2198,7 @@ def prepare_request(next_link=None): 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) @@ -2093,6 +2210,7 @@ def prepare_request(next_link=None): 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) @@ -2110,7 +2228,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]: @@ -2123,9 +2245,9 @@ def get_next(next_link=None): 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: str, vm_name: str, @@ -2138,18 +2260,25 @@ def _power_off_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -2159,11 +2288,11 @@ 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 @distributed_trace - def begin_power_off( + def begin_power_off( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2179,7 +2308,7 @@ 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. @@ -2193,7 +2322,8 @@ def begin_power_off( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2205,6 +2335,7 @@ 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 ) @@ -2225,12 +2356,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2242,17 +2372,24 @@ def _reapply_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -2262,11 +2399,11 @@ 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 @distributed_trace - def begin_reapply( + def begin_reapply( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2290,7 +2427,8 @@ def begin_reapply( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2301,6 +2439,7 @@ 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 ) @@ -2321,12 +2460,11 @@ 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) + 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 + 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: str, vm_name: str, @@ -2338,17 +2476,24 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -2358,11 +2503,11 @@ 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 @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2386,7 +2531,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2397,6 +2543,7 @@ 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 ) @@ -2417,12 +2564,11 @@ 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) + 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 + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2434,17 +2580,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -2454,11 +2607,11 @@ 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 @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2482,7 +2635,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2493,6 +2647,7 @@ 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 ) @@ -2513,12 +2668,11 @@ 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) + 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 + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore - def _redeploy_initial( + def _redeploy_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2530,17 +2684,24 @@ def _redeploy_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -2550,11 +2711,11 @@ 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 @distributed_trace - def begin_redeploy( + def begin_redeploy( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2578,7 +2739,8 @@ def begin_redeploy( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2589,6 +2751,7 @@ 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 ) @@ -2609,12 +2772,11 @@ 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) + 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 + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore - def _reimage_initial( + def _reimage_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2627,6 +2789,7 @@ def _reimage_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -2638,6 +2801,7 @@ def _reimage_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'], @@ -2645,7 +2809,11 @@ def _reimage_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -2655,11 +2823,11 @@ 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 @distributed_trace - def begin_reimage( + def begin_reimage( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2672,7 +2840,8 @@ 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_11_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. @@ -2686,8 +2855,9 @@ def begin_reimage( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2699,6 +2869,7 @@ 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 @@ -2720,10 +2891,9 @@ 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) + 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 + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore @distributed_trace def retrieve_boot_diagnostics_data( @@ -2741,7 +2911,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) @@ -2754,18 +2924,25 @@ def retrieve_boot_diagnostics_data( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -2779,10 +2956,10 @@ def retrieve_boot_diagnostics_data( return deserialized - retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore - def _perform_maintenance_initial( + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2794,17 +2971,24 @@ def _perform_maintenance_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -2814,11 +2998,11 @@ 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 @distributed_trace - def begin_perform_maintenance( + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2842,7 +3026,8 @@ def begin_perform_maintenance( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2853,6 +3038,7 @@ 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 ) @@ -2873,13 +3059,12 @@ 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) + 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 + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore @distributed_trace - def simulate_eviction( + def simulate_eviction( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vm_name: str, @@ -2902,17 +3087,24 @@ def simulate_eviction( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str + 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) - 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]: @@ -2922,7 +3114,7 @@ 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( @@ -2937,17 +3129,24 @@ def _assess_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: 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) - 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]: @@ -2963,7 +3162,7 @@ def _assess_patches_initial( 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 @@ -2993,7 +3192,8 @@ def begin_assess_patches( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineAssessPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -3004,6 +3204,7 @@ 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 ) @@ -3027,10 +3228,9 @@ 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) + 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 + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore def _install_patches_initial( self, @@ -3045,6 +3245,7 @@ def _install_patches_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') @@ -3053,6 +3254,7 @@ def _install_patches_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'], @@ -3060,7 +3262,11 @@ def _install_patches_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3076,7 +3282,7 @@ def _install_patches_initial( 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 @@ -3110,8 +3316,9 @@ def begin_install_patches( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.VirtualMachineInstallPatchesResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -3123,6 +3330,7 @@ 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 @@ -3147,16 +3355,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) + 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 + 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: 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"]] @@ -3165,7 +3374,7 @@ def _run_command_initial( } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', "2021-11-01") # type: str _json = self._serialize.body(parameters, 'RunCommandInput') @@ -3173,6 +3382,7 @@ def _run_command_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'], @@ -3180,7 +3390,11 @@ def _run_command_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -3196,7 +3410,7 @@ def _run_command_initial( 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 @@ -3205,6 +3419,8 @@ def begin_run_command( 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. @@ -3215,6 +3431,9 @@ def begin_run_command( :type vm_name: str :param parameters: Parameters supplied to the Run command operation. :type parameters: ~azure.mgmt.compute.v2021_11_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 @@ -3228,8 +3447,8 @@ def begin_run_command( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_11_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-11-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( 'polling_interval', @@ -3242,6 +3461,7 @@ def begin_run_command( vm_name=vm_name, parameters=parameters, content_type=content_type, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -3265,7 +3485,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) + 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 + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_compute_management_client.py index e95ba4c1f78d..ea2e2c134e29 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import ComputeManagementClientConfiguration @@ -41,8 +42,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-12-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. """ @@ -70,7 +74,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_configuration.py index 2d7278e47e05..ea8376ecf958 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_configuration.py @@ -19,7 +19,7 @@ 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 @@ -27,8 +27,12 @@ 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-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-12-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_metadata.json index ffed1a6480bd..e2ad5d07a2d5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_version.py index 5b330c36d73d..e5754a47ce68 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_version.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "26.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/_compute_management_client.py index 9973060b60f9..a9d9f64154f7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/_compute_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import ComputeManagementClientConfiguration @@ -41,8 +42,11 @@ class ComputeManagementClient: :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :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-12-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. """ diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/_configuration.py index 0343b3b390ba..7d517f26b800 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/_configuration.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/_configuration.py @@ -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-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-12-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) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_accesses_operations.py index a15e4f6cfb37..b733129eae9d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace_async async def get_private_link_resources( @@ -602,17 +646,24 @@ async def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -626,7 +677,7 @@ async def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore async def _update_a_private_endpoint_connection_initial( @@ -643,6 +694,7 @@ async def _update_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -652,6 +704,7 @@ async def _update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], @@ -659,7 +712,11 @@ async def _update_a_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -677,7 +734,7 @@ async def _update_a_private_endpoint_connection_initial( return deserialized - _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -718,8 +775,9 @@ async def begin_update_a_private_endpoint_connection( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -732,6 +790,7 @@ async def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -756,10 +815,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_update_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async async def get_a_private_endpoint_connection( @@ -790,18 +848,25 @@ async def get_a_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_a_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_a_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -815,10 +880,10 @@ async def get_a_private_endpoint_connection( return deserialized - get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - async def _delete_a_private_endpoint_connection_initial( + async def _delete_a_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -831,18 +896,25 @@ async def _delete_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_a_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -852,11 +924,11 @@ async def _delete_a_private_endpoint_connection_initial( if cls: return cls(pipeline_response, None, {}) - _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete_a_private_endpoint_connection( + async def begin_delete_a_private_endpoint_connection( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -885,7 +957,8 @@ async def begin_delete_a_private_endpoint_connection( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -897,6 +970,7 @@ async def begin_delete_a_private_endpoint_connection( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -917,10 +991,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_private_endpoint_connections( @@ -944,6 +1017,8 @@ def list_private_endpoint_connections( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_12_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -956,6 +1031,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) @@ -967,6 +1043,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -984,7 +1061,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]: @@ -997,4 +1078,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_encryption_sets_operations.py index 8282c1216e06..b01ebc1efca0 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -130,8 +135,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,6 +149,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -167,10 +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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore async def _update_initial( self, @@ -185,6 +191,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -193,6 +200,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -200,7 +208,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -218,7 +230,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async @@ -254,8 +266,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,6 +280,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -291,10 +305,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async async def get( @@ -322,17 +335,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -346,10 +366,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -361,17 +381,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -381,11 +408,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -411,7 +438,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -422,6 +450,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -442,10 +471,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -464,6 +492,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -475,6 +505,7 @@ def prepare_request(next_link=None): 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) @@ -485,6 +516,7 @@ def prepare_request(next_link=None): 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) @@ -502,7 +534,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]: @@ -515,7 +551,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -531,6 +567,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -541,6 +579,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -550,6 +589,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -567,7 +607,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]: @@ -580,7 +624,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -603,6 +647,8 @@ def list_associated_resources( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_12_01.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -615,6 +661,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -626,6 +673,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -643,7 +691,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]: @@ -656,4 +708,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_restore_point_operations.py index af06677255c4..e25bfa641f6f 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disk_restore_point_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -80,6 +79,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -87,12 +88,17 @@ async def get( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_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) - 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]: @@ -106,7 +112,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}"} # type: ignore @distributed_trace @@ -134,6 +140,8 @@ def list_by_restore_point( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -147,6 +155,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=self.list_by_restore_point.metadata['url'], ) request = _convert_request(request) @@ -159,6 +168,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -176,7 +186,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]: @@ -189,7 +203,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + list_by_restore_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints"} # type: ignore async def _grant_access_initial( self, @@ -206,6 +220,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -216,6 +231,7 @@ async def _grant_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -223,7 +239,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -239,7 +259,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -280,8 +300,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,6 +316,7 @@ async def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -319,12 +341,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -338,6 +359,8 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, @@ -345,12 +368,17 @@ async def _revoke_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -360,11 +388,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -396,7 +424,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -409,6 +438,7 @@ async def begin_revoke_access( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -429,7 +459,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disks_operations.py index 7537c9f851cc..bb4273d016d7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -127,8 +132,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -140,6 +146,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -164,10 +171,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore async def _update_initial( self, @@ -182,6 +188,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -190,6 +197,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -197,7 +205,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -215,7 +227,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async @@ -248,8 +260,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -261,6 +274,7 @@ async def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -285,10 +299,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async async def get( @@ -316,17 +329,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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]: @@ -340,10 +360,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -355,17 +375,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -375,11 +402,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -405,7 +432,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,6 +444,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -436,10 +465,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -457,6 +485,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,6 +498,7 @@ def prepare_request(next_link=None): 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) @@ -478,6 +509,7 @@ def prepare_request(next_link=None): 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) @@ -495,7 +527,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]: @@ -508,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -523,6 +559,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,6 +571,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -542,6 +581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -559,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]: @@ -572,7 +616,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore async def _grant_access_initial( self, @@ -587,6 +631,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -595,6 +640,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -602,7 +648,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -618,7 +668,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -653,8 +703,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -666,6 +717,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -690,12 +742,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -707,17 +758,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -727,11 +785,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -757,7 +815,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -768,6 +827,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -788,7 +848,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_snapshots_operations.py index 37dabc2dd009..41f568cf72c2 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/aio/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -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 @@ -61,6 +60,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -69,6 +69,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -76,7 +77,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -94,7 +99,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -128,8 +133,9 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -141,6 +147,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -165,10 +172,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore async def _update_initial( self, @@ -183,6 +189,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -191,6 +198,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -198,7 +206,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -216,7 +228,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async @@ -250,8 +262,9 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -263,6 +276,7 @@ async def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -287,10 +301,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async async def get( @@ -318,17 +331,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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]: @@ -342,10 +362,10 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -357,17 +377,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -377,11 +404,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -407,7 +434,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -418,6 +446,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -438,10 +467,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -459,6 +487,8 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_12_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -470,6 +500,7 @@ def prepare_request(next_link=None): 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) @@ -480,6 +511,7 @@ def prepare_request(next_link=None): 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) @@ -497,7 +529,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]: @@ -510,7 +546,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -525,6 +561,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_12_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -535,6 +573,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,6 +583,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -561,7 +601,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]: @@ -574,7 +618,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore async def _grant_access_initial( self, @@ -589,6 +633,7 @@ async def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -597,6 +642,7 @@ async def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -604,7 +650,11 @@ async def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -620,7 +670,7 @@ async def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace_async @@ -655,8 +705,9 @@ async def begin_grant_access( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -668,6 +719,7 @@ async def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -692,12 +744,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - async def _revoke_access_initial( + async def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -709,17 +760,24 @@ async def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -729,11 +787,11 @@ async def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace_async - async def begin_revoke_access( + async def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -759,7 +817,8 @@ async def begin_revoke_access( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -770,6 +829,7 @@ async def begin_revoke_access( raw_result = await self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -790,7 +850,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) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_accesses_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_accesses_operations.py index 71e588a792b9..bfd94ef9975b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_accesses_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_accesses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_get_private_link_resources_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -296,12 +301,12 @@ def build_update_a_private_endpoint_connection_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -309,23 +314,23 @@ def build_update_a_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -339,10 +344,11 @@ def build_get_a_private_endpoint_connection_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -350,21 +356,21 @@ def build_get_a_private_endpoint_connection_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -376,10 +382,11 @@ def build_delete_a_private_endpoint_connection_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), @@ -387,21 +394,21 @@ def build_delete_a_private_endpoint_connection_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -412,31 +419,32 @@ def build_list_private_endpoint_connections_request( disk_access_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections") # 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'), "diskAccessName": _SERIALIZER.url("disk_access_name", disk_access_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -475,6 +483,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccess') @@ -483,6 +492,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -490,7 +500,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -508,7 +522,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -541,8 +555,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -554,6 +569,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -578,10 +594,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore def _update_initial( self, @@ -596,6 +611,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_access, 'DiskAccessUpdate') @@ -604,6 +620,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -611,7 +628,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -629,7 +650,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace @@ -662,8 +683,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.DiskAccess] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccess"] lro_delay = kwargs.pop( 'polling_interval', @@ -675,6 +697,7 @@ def begin_update( resource_group_name=resource_group_name, disk_access_name=disk_access_name, disk_access=disk_access, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -699,10 +722,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def get( @@ -730,17 +752,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_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(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]: @@ -754,10 +783,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -769,17 +798,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -789,11 +825,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -819,7 +855,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -830,6 +867,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -850,10 +888,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -870,6 +907,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -881,6 +920,7 @@ def prepare_request(next_link=None): 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) @@ -891,6 +931,7 @@ def prepare_request(next_link=None): 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) @@ -908,7 +949,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]: @@ -921,7 +966,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def list( @@ -935,6 +980,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskAccessList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskAccessList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -945,6 +992,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -954,6 +1002,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -971,7 +1020,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]: @@ -984,7 +1037,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses"} # type: ignore @distributed_trace def get_private_link_resources( @@ -1012,17 +1065,24 @@ def get_private_link_resources( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_private_link_resources_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.get_private_link_resources.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1036,7 +1096,7 @@ def get_private_link_resources( return deserialized - get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources'} # type: ignore + get_private_link_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources"} # type: ignore def _update_a_private_endpoint_connection_initial( @@ -1053,6 +1113,7 @@ def _update_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection') @@ -1062,6 +1123,7 @@ def _update_a_private_endpoint_connection_initial( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_a_private_endpoint_connection_initial.metadata['url'], @@ -1069,7 +1131,11 @@ def _update_a_private_endpoint_connection_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -1087,7 +1153,7 @@ def _update_a_private_endpoint_connection_initial( return deserialized - _update_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _update_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace @@ -1128,8 +1194,9 @@ def begin_update_a_private_endpoint_connection( ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -1142,6 +1209,7 @@ def begin_update_a_private_endpoint_connection( disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, private_endpoint_connection=private_endpoint_connection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1166,10 +1234,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_update_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def get_a_private_endpoint_connection( @@ -1200,18 +1267,25 @@ def get_a_private_endpoint_connection( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_a_private_endpoint_connection_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get_a_private_endpoint_connection.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1225,10 +1299,10 @@ def get_a_private_endpoint_connection( return deserialized - get_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - def _delete_a_private_endpoint_connection_initial( + def _delete_a_private_endpoint_connection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -1241,18 +1315,25 @@ def _delete_a_private_endpoint_connection_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_a_private_endpoint_connection_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_a_private_endpoint_connection_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1262,11 +1343,11 @@ def _delete_a_private_endpoint_connection_initial( if cls: return cls(pipeline_response, None, {}) - _delete_a_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_a_private_endpoint_connection_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete_a_private_endpoint_connection( + def begin_delete_a_private_endpoint_connection( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_access_name: str, @@ -1295,7 +1376,8 @@ def begin_delete_a_private_endpoint_connection( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1307,6 +1389,7 @@ def begin_delete_a_private_endpoint_connection( resource_group_name=resource_group_name, disk_access_name=disk_access_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1327,10 +1410,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete_a_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete_a_private_endpoint_connection.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace def list_private_endpoint_connections( @@ -1354,6 +1436,8 @@ def list_private_endpoint_connections( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_12_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1366,6 +1450,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=self.list_private_endpoint_connections.metadata['url'], ) request = _convert_request(request) @@ -1377,6 +1462,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_access_name=disk_access_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1394,7 +1480,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]: @@ -1407,4 +1497,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections'} # type: ignore + list_private_endpoint_connections.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_encryption_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_encryption_sets_operations.py index c5458bafa1fd..e5503539f0ee 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_encryption_sets_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_encryption_sets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,31 +159,32 @@ def build_delete_request_initial( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -192,30 +194,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -224,29 +227,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -257,31 +261,32 @@ def build_list_associated_resources_request( disk_encryption_set_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources") # 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'), "diskEncryptionSetName": _SERIALIZER.url("disk_encryption_set_name", disk_encryption_set_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -320,6 +325,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSet') @@ -328,6 +334,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -335,7 +342,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -353,7 +364,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -388,8 +399,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -401,6 +413,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -425,10 +438,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore def _update_initial( self, @@ -443,6 +455,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk_encryption_set, 'DiskEncryptionSetUpdate') @@ -451,6 +464,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -458,7 +472,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -476,7 +494,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace @@ -511,8 +529,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.DiskEncryptionSet] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSet"] lro_delay = kwargs.pop( 'polling_interval', @@ -524,6 +543,7 @@ def begin_update( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, disk_encryption_set=disk_encryption_set, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -548,10 +568,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def get( @@ -579,17 +598,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + 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(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]: @@ -603,10 +629,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -618,17 +644,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -638,11 +671,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_encryption_set_name: str, @@ -668,7 +701,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -679,6 +713,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -699,10 +734,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -721,6 +755,8 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -732,6 +768,7 @@ def prepare_request(next_link=None): 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) @@ -742,6 +779,7 @@ def prepare_request(next_link=None): 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) @@ -759,7 +797,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]: @@ -772,7 +814,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list( @@ -788,6 +830,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskEncryptionSetList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskEncryptionSetList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -798,6 +842,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -807,6 +852,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -824,7 +870,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]: @@ -837,7 +887,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets"} # type: ignore @distributed_trace def list_associated_resources( @@ -859,6 +909,8 @@ def list_associated_resources( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_12_01.models.ResourceUriList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUriList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -871,6 +923,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=self.list_associated_resources.metadata['url'], ) request = _convert_request(request) @@ -882,6 +935,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_encryption_set_name=disk_encryption_set_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -899,7 +953,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]: @@ -912,4 +970,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_associated_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources'} # type: ignore + list_associated_resources.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_restore_point_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_restore_point_operations.py index 5ca8c5c55284..2baa11e0ba0b 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_restore_point_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disk_restore_point_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( disk_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}") # 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'), @@ -49,21 +50,21 @@ def build_get_request( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -75,10 +76,11 @@ def build_list_by_restore_point_request( vm_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints") # 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'), @@ -86,21 +88,21 @@ def build_list_by_restore_point_request( "vmRestorePointName": _SERIALIZER.url("vm_restore_point_name", vm_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -116,12 +118,12 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess") # 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'), @@ -130,23 +132,23 @@ def build_grant_access_request_initial( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -161,10 +163,11 @@ def build_revoke_access_request_initial( disk_restore_point_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess") # 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'), @@ -173,21 +176,21 @@ def build_revoke_access_request_initial( "diskRestorePointName": _SERIALIZER.url("disk_restore_point_name", disk_restore_point_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -245,6 +248,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -252,12 +257,17 @@ def get( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_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) - 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]: @@ -271,7 +281,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}"} # type: ignore @distributed_trace @@ -299,6 +309,8 @@ def list_by_restore_point( ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskRestorePointList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskRestorePointList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -312,6 +324,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=self.list_by_restore_point.metadata['url'], ) request = _convert_request(request) @@ -324,6 +337,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -341,7 +355,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]: @@ -354,7 +372,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_restore_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints'} # type: ignore + list_by_restore_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints"} # type: ignore def _grant_access_initial( self, @@ -371,6 +389,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -381,6 +400,7 @@ def _grant_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -388,7 +408,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -404,7 +428,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore @distributed_trace @@ -444,8 +468,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -459,6 +484,7 @@ def begin_grant_access( vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -483,12 +509,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -502,6 +527,8 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, @@ -509,12 +536,17 @@ def _revoke_access_initial( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -524,11 +556,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, restore_point_collection_name: str, @@ -560,7 +592,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -573,6 +606,7 @@ def begin_revoke_access( restore_point_collection_name=restore_point_collection_name, vm_restore_point_name=vm_restore_point_name, disk_restore_point_name=disk_restore_point_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -593,7 +627,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disks_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disks_operations.py index d8b3ab6cc459..c984c68156c1 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disks_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_disks_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( disk_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess") # 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'), "diskName": _SERIALIZER.url("disk_name", disk_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'Disk') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(disk, 'DiskUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.Disk] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Disk"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, disk_name=disk_name, disk=disk, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_12_01.models.DiskList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DiskList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, disk_name=disk_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, disk_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, disk_name=disk_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_snapshots_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_snapshots_operations.py index d04e337e8e5e..bcca8a613552 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_snapshots_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_12_01/operations/_snapshots_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from 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 @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,35 +38,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -82,35 +82,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,31 +123,32 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -158,25 +159,26 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -186,30 +188,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots") # 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) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -218,29 +221,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -254,35 +258,35 @@ def build_grant_access_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -295,25 +299,26 @@ def build_revoke_access_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess") # 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'), "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_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 = 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, + url=_url, + params=_query_parameters, **kwargs ) @@ -352,6 +357,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'Snapshot') @@ -360,6 +366,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -367,7 +374,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -385,7 +396,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -418,8 +429,9 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,6 +443,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -455,10 +468,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore def _update_initial( self, @@ -473,6 +485,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(snapshot, 'SnapshotUpdate') @@ -481,6 +494,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -488,7 +502,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -506,7 +524,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace @@ -539,8 +557,9 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.Snapshot] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -552,6 +571,7 @@ def begin_update( resource_group_name=resource_group_name, snapshot_name=snapshot_name, snapshot=snapshot, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -576,10 +596,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def get( @@ -607,17 +626,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_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(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,10 +657,10 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -646,17 +672,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -666,11 +699,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -696,7 +729,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -707,6 +741,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -727,10 +762,9 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}"} # type: ignore @distributed_trace def list_by_resource_group( @@ -747,6 +781,8 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_12_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -758,6 +794,7 @@ def prepare_request(next_link=None): 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) @@ -768,6 +805,7 @@ def prepare_request(next_link=None): 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) @@ -785,7 +823,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]: @@ -798,7 +840,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots"} # type: ignore @distributed_trace def list( @@ -812,6 +854,8 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_12_01.models.SnapshotList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -822,6 +866,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -831,6 +876,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -848,7 +894,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]: @@ -861,7 +911,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots"} # type: ignore def _grant_access_initial( self, @@ -876,6 +926,7 @@ def _grant_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(grant_access_data, 'GrantAccessData') @@ -884,6 +935,7 @@ def _grant_access_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._grant_access_initial.metadata['url'], @@ -891,7 +943,11 @@ def _grant_access_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - 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]: @@ -907,7 +963,7 @@ def _grant_access_initial( return deserialized - _grant_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + _grant_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore @distributed_trace @@ -941,8 +997,9 @@ def begin_grant_access( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_12_01.models.AccessUri] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AccessUri"] lro_delay = kwargs.pop( 'polling_interval', @@ -954,6 +1011,7 @@ def begin_grant_access( resource_group_name=resource_group_name, snapshot_name=snapshot_name, grant_access_data=grant_access_data, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -978,12 +1036,11 @@ 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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_grant_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess'} # type: ignore + begin_grant_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess"} # type: ignore - def _revoke_access_initial( + def _revoke_access_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -995,17 +1052,24 @@ def _revoke_access_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_revoke_access_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, template_url=self._revoke_access_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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]: @@ -1015,11 +1079,11 @@ def _revoke_access_initial( if cls: return cls(pipeline_response, None, {}) - _revoke_access_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + _revoke_access_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore @distributed_trace - def begin_revoke_access( + def begin_revoke_access( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, snapshot_name: str, @@ -1045,7 +1109,8 @@ def begin_revoke_access( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1056,6 +1121,7 @@ def begin_revoke_access( raw_result = self._revoke_access_initial( resource_group_name=resource_group_name, snapshot_name=snapshot_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1076,7 +1142,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) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_revoke_access.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess'} # type: ignore + begin_revoke_access.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/__init__.py new file mode 100644 index 000000000000..fd39b8a6c901 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._compute_management_client import ComputeManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_compute_management_client.py new file mode 100644 index 000000000000..bea06d2f20e8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_compute_management_client.py @@ -0,0 +1,195 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, CapacityReservationGroupsOperations, CapacityReservationsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, RestorePointCollectionsOperations, RestorePointsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesEdgeZoneOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes + """Compute Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.compute.v2022_03_01.operations.Operations + :ivar usage: UsageOperations operations + :vartype usage: azure.mgmt.compute.v2022_03_01.operations.UsageOperations + :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineSizesOperations + :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineScaleSetVMExtensionsOperations + :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineScaleSetVMsOperations + :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineExtensionsOperations + :ivar virtual_machines: VirtualMachinesOperations operations + :vartype virtual_machines: azure.mgmt.compute.v2022_03_01.operations.VirtualMachinesOperations + :ivar virtual_machine_images: VirtualMachineImagesOperations operations + :vartype virtual_machine_images: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineImagesOperations + :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineImagesEdgeZoneOperations + :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineExtensionImagesOperations + :ivar availability_sets: AvailabilitySetsOperations operations + :vartype availability_sets: + azure.mgmt.compute.v2022_03_01.operations.AvailabilitySetsOperations + :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2022_03_01.operations.ProximityPlacementGroupsOperations + :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2022_03_01.operations.DedicatedHostGroupsOperations + :ivar dedicated_hosts: DedicatedHostsOperations operations + :vartype dedicated_hosts: azure.mgmt.compute.v2022_03_01.operations.DedicatedHostsOperations + :ivar ssh_public_keys: SshPublicKeysOperations operations + :vartype ssh_public_keys: azure.mgmt.compute.v2022_03_01.operations.SshPublicKeysOperations + :ivar images: ImagesOperations operations + :vartype images: azure.mgmt.compute.v2022_03_01.operations.ImagesOperations + :ivar restore_point_collections: RestorePointCollectionsOperations operations + :vartype restore_point_collections: + azure.mgmt.compute.v2022_03_01.operations.RestorePointCollectionsOperations + :ivar restore_points: RestorePointsOperations operations + :vartype restore_points: azure.mgmt.compute.v2022_03_01.operations.RestorePointsOperations + :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations + :vartype capacity_reservation_groups: + azure.mgmt.compute.v2022_03_01.operations.CapacityReservationGroupsOperations + :ivar capacity_reservations: CapacityReservationsOperations operations + :vartype capacity_reservations: + azure.mgmt.compute.v2022_03_01.operations.CapacityReservationsOperations + :ivar log_analytics: LogAnalyticsOperations operations + :vartype log_analytics: azure.mgmt.compute.v2022_03_01.operations.LogAnalyticsOperations + :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineRunCommandsOperations + :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations + operations + :vartype virtual_machine_scale_set_vm_run_commands: + azure.mgmt.compute.v2022_03_01.operations.VirtualMachineScaleSetVMRunCommandsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-03-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: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_sizes = VirtualMachineSizesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_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.virtual_machine_extensions = VirtualMachineExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images_edge_zone = VirtualMachineImagesEdgeZoneOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations(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.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.log_analytics = LogAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ComputeManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_configuration.py new file mode 100644 index 000000000000..237926d14db1 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_configuration.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ComputeManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ComputeManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-03-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.") + + self.credential = credential + self.subscription_id = subscription_id + 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) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_metadata.json new file mode 100644 index 000000000000..652196019d4d --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_metadata.json @@ -0,0 +1,127 @@ +{ + "chosen_version": "2022-03-01", + "total_api_version_list": ["2022-03-01"], + "client": { + "name": "ComputeManagementClient", + "filename": "_compute_management_client", + "description": "Compute Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ComputeManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "usage": "UsageOperations", + "virtual_machine_sizes": "VirtualMachineSizesOperations", + "virtual_machine_scale_sets": "VirtualMachineScaleSetsOperations", + "virtual_machine_scale_set_extensions": "VirtualMachineScaleSetExtensionsOperations", + "virtual_machine_scale_set_rolling_upgrades": "VirtualMachineScaleSetRollingUpgradesOperations", + "virtual_machine_scale_set_vm_extensions": "VirtualMachineScaleSetVMExtensionsOperations", + "virtual_machine_scale_set_vms": "VirtualMachineScaleSetVMsOperations", + "virtual_machine_extensions": "VirtualMachineExtensionsOperations", + "virtual_machines": "VirtualMachinesOperations", + "virtual_machine_images": "VirtualMachineImagesOperations", + "virtual_machine_images_edge_zone": "VirtualMachineImagesEdgeZoneOperations", + "virtual_machine_extension_images": "VirtualMachineExtensionImagesOperations", + "availability_sets": "AvailabilitySetsOperations", + "proximity_placement_groups": "ProximityPlacementGroupsOperations", + "dedicated_host_groups": "DedicatedHostGroupsOperations", + "dedicated_hosts": "DedicatedHostsOperations", + "ssh_public_keys": "SshPublicKeysOperations", + "images": "ImagesOperations", + "restore_point_collections": "RestorePointCollectionsOperations", + "restore_points": "RestorePointsOperations", + "capacity_reservation_groups": "CapacityReservationGroupsOperations", + "capacity_reservations": "CapacityReservationsOperations", + "log_analytics": "LogAnalyticsOperations", + "virtual_machine_run_commands": "VirtualMachineRunCommandsOperations", + "virtual_machine_scale_set_vm_run_commands": "VirtualMachineScaleSetVMRunCommandsOperations" + } +} \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_vendor.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_version.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/__init__.py new file mode 100644 index 000000000000..9c044a7dd939 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._compute_management_client import ComputeManagementClient +__all__ = ['ComputeManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_compute_management_client.py new file mode 100644 index 000000000000..fbfdac255170 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_compute_management_client.py @@ -0,0 +1,194 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import ComputeManagementClientConfiguration +from .operations import AvailabilitySetsOperations, CapacityReservationGroupsOperations, CapacityReservationsOperations, DedicatedHostGroupsOperations, DedicatedHostsOperations, ImagesOperations, LogAnalyticsOperations, Operations, ProximityPlacementGroupsOperations, RestorePointCollectionsOperations, RestorePointsOperations, SshPublicKeysOperations, UsageOperations, VirtualMachineExtensionImagesOperations, VirtualMachineExtensionsOperations, VirtualMachineImagesEdgeZoneOperations, VirtualMachineImagesOperations, VirtualMachineRunCommandsOperations, VirtualMachineScaleSetExtensionsOperations, VirtualMachineScaleSetRollingUpgradesOperations, VirtualMachineScaleSetVMExtensionsOperations, VirtualMachineScaleSetVMRunCommandsOperations, VirtualMachineScaleSetVMsOperations, VirtualMachineScaleSetsOperations, VirtualMachineSizesOperations, VirtualMachinesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class ComputeManagementClient: # pylint: disable=too-many-instance-attributes + """Compute Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.compute.v2022_03_01.aio.operations.Operations + :ivar usage: UsageOperations operations + :vartype usage: azure.mgmt.compute.v2022_03_01.aio.operations.UsageOperations + :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations + :vartype virtual_machine_sizes: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineSizesOperations + :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations + :vartype virtual_machine_scale_sets: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations + operations + :vartype virtual_machine_scale_set_extensions: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: + VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations + operations + :vartype virtual_machine_scale_set_vm_extensions: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations + :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations + :vartype virtual_machine_scale_set_vms: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineScaleSetVMsOperations + :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations + :vartype virtual_machine_extensions: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineExtensionsOperations + :ivar virtual_machines: VirtualMachinesOperations operations + :vartype virtual_machines: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachinesOperations + :ivar virtual_machine_images: VirtualMachineImagesOperations operations + :vartype virtual_machine_images: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineImagesOperations + :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations + :vartype virtual_machine_images_edge_zone: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineImagesEdgeZoneOperations + :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations + :vartype virtual_machine_extension_images: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineExtensionImagesOperations + :ivar availability_sets: AvailabilitySetsOperations operations + :vartype availability_sets: + azure.mgmt.compute.v2022_03_01.aio.operations.AvailabilitySetsOperations + :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations + :vartype proximity_placement_groups: + azure.mgmt.compute.v2022_03_01.aio.operations.ProximityPlacementGroupsOperations + :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations + :vartype dedicated_host_groups: + azure.mgmt.compute.v2022_03_01.aio.operations.DedicatedHostGroupsOperations + :ivar dedicated_hosts: DedicatedHostsOperations operations + :vartype dedicated_hosts: + azure.mgmt.compute.v2022_03_01.aio.operations.DedicatedHostsOperations + :ivar ssh_public_keys: SshPublicKeysOperations operations + :vartype ssh_public_keys: azure.mgmt.compute.v2022_03_01.aio.operations.SshPublicKeysOperations + :ivar images: ImagesOperations operations + :vartype images: azure.mgmt.compute.v2022_03_01.aio.operations.ImagesOperations + :ivar restore_point_collections: RestorePointCollectionsOperations operations + :vartype restore_point_collections: + azure.mgmt.compute.v2022_03_01.aio.operations.RestorePointCollectionsOperations + :ivar restore_points: RestorePointsOperations operations + :vartype restore_points: azure.mgmt.compute.v2022_03_01.aio.operations.RestorePointsOperations + :ivar capacity_reservation_groups: CapacityReservationGroupsOperations operations + :vartype capacity_reservation_groups: + azure.mgmt.compute.v2022_03_01.aio.operations.CapacityReservationGroupsOperations + :ivar capacity_reservations: CapacityReservationsOperations operations + :vartype capacity_reservations: + azure.mgmt.compute.v2022_03_01.aio.operations.CapacityReservationsOperations + :ivar log_analytics: LogAnalyticsOperations operations + :vartype log_analytics: azure.mgmt.compute.v2022_03_01.aio.operations.LogAnalyticsOperations + :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations + :vartype virtual_machine_run_commands: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineRunCommandsOperations + :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations + operations + :vartype virtual_machine_scale_set_vm_run_commands: + azure.mgmt.compute.v2022_03_01.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-03-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: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_sizes = VirtualMachineSizesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_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.virtual_machine_extensions = VirtualMachineExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images_edge_zone = VirtualMachineImagesEdgeZoneOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations(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.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.log_analytics = LogAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ComputeManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_configuration.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_configuration.py new file mode 100644 index 000000000000..6ec93e6d2369 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_configuration.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ComputeManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ComputeManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ComputeManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-03-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.") + + self.credential = credential + self.subscription_id = subscription_id + 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) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_patch.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/__init__.py new file mode 100644 index 000000000000..9e7600d93081 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/__init__.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._usage_operations import UsageOperations +from ._virtual_machine_sizes_operations import VirtualMachineSizesOperations +from ._virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations +from ._virtual_machine_scale_set_extensions_operations import VirtualMachineScaleSetExtensionsOperations +from ._virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations +from ._virtual_machine_scale_set_vm_extensions_operations import VirtualMachineScaleSetVMExtensionsOperations +from ._virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations +from ._virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from ._virtual_machines_operations import VirtualMachinesOperations +from ._virtual_machine_images_operations import VirtualMachineImagesOperations +from ._virtual_machine_images_edge_zone_operations import VirtualMachineImagesEdgeZoneOperations +from ._virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations +from ._availability_sets_operations import AvailabilitySetsOperations +from ._proximity_placement_groups_operations import ProximityPlacementGroupsOperations +from ._dedicated_host_groups_operations import DedicatedHostGroupsOperations +from ._dedicated_hosts_operations import DedicatedHostsOperations +from ._ssh_public_keys_operations import SshPublicKeysOperations +from ._images_operations import ImagesOperations +from ._restore_point_collections_operations import RestorePointCollectionsOperations +from ._restore_points_operations import RestorePointsOperations +from ._capacity_reservation_groups_operations import CapacityReservationGroupsOperations +from ._capacity_reservations_operations import CapacityReservationsOperations +from ._log_analytics_operations import LogAnalyticsOperations +from ._virtual_machine_run_commands_operations import VirtualMachineRunCommandsOperations +from ._virtual_machine_scale_set_vm_run_commands_operations import VirtualMachineScaleSetVMRunCommandsOperations + +__all__ = [ + 'Operations', + 'UsageOperations', + 'VirtualMachineSizesOperations', + 'VirtualMachineScaleSetsOperations', + 'VirtualMachineScaleSetExtensionsOperations', + 'VirtualMachineScaleSetRollingUpgradesOperations', + 'VirtualMachineScaleSetVMExtensionsOperations', + 'VirtualMachineScaleSetVMsOperations', + 'VirtualMachineExtensionsOperations', + 'VirtualMachinesOperations', + 'VirtualMachineImagesOperations', + 'VirtualMachineImagesEdgeZoneOperations', + 'VirtualMachineExtensionImagesOperations', + 'AvailabilitySetsOperations', + 'ProximityPlacementGroupsOperations', + 'DedicatedHostGroupsOperations', + 'DedicatedHostsOperations', + 'SshPublicKeysOperations', + 'ImagesOperations', + 'RestorePointCollectionsOperations', + 'RestorePointsOperations', + 'CapacityReservationGroupsOperations', + 'CapacityReservationsOperations', + 'LogAnalyticsOperations', + 'VirtualMachineRunCommandsOperations', + 'VirtualMachineScaleSetVMRunCommandsOperations', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_availability_sets_operations.py new file mode 100644 index 000000000000..8ad17236b543 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_availability_sets_operations.py @@ -0,0 +1,529 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.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]] + +class AvailabilitySetsOperations: + """AvailabilitySetsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def create_or_update( + self, + 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. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.AvailabilitySet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + 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. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.AvailabilitySetUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + 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. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.AvailabilitySetListResult"]: + """Lists all availability sets in a subscription. + + :param expand: The expand expression to apply to the operation. Allowed values are + '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.v2022_03_01.models.AvailabilitySetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AvailabilitySetListResult"]: + """Lists all availability sets in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailabilitySetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.AvailabilitySetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets"} # type: ignore + + @distributed_trace + def list_available_sizes( + self, + resource_group_name: str, + availability_set_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineSizeListResult"]: + """Lists all available virtual machine sizes that can be used to create a new virtual machine in + an existing availability set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_available_sizes.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_capacity_reservation_groups_operations.py new file mode 100644 index 000000000000..571d4bbe64a3 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_capacity_reservation_groups_operations.py @@ -0,0 +1,475 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +from azure.core.rest import HttpRequest +from azure.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]] + +class CapacityReservationGroupsOperations: + """CapacityReservationGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def create_or_update( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.CapacityReservationGroup + :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.v2022_03_01.models.CapacityReservationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CapacityReservationGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CapacityReservationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.CapacityReservationGroupUpdate + :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.v2022_03_01.models.CapacityReservationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CapacityReservationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + 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 + https://aka.ms/CapacityReservation for more details. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :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: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + 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. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :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. Default value is None. + :type expand: str or + ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.CapacityReservationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CapacityReservationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, + **kwargs: Any + ) -> AsyncIterable["_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. + + :param resource_group_name: The name of the 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. Default value is None. + :type expand: str or + ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.CapacityReservationGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups"} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + expand: Optional[Union[str, "_models.ExpandTypesForGetCapacityReservationGroups"]] = None, + **kwargs: Any + ) -> AsyncIterable["_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. Default value is None. + :type expand: str or + ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.CapacityReservationGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_capacity_reservations_operations.py new file mode 100644 index 000000000000..287cba1c3be6 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_capacity_reservations_operations.py @@ -0,0 +1,581 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +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]] + +class CapacityReservationsOperations: + """CapacityReservationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CapacityReservation', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CapacityReservation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: "_models.CapacityReservation", + **kwargs: Any + ) -> AsyncLROPoller["_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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. + :type parameters: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + 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) + + 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 + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CapacityReservation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + parameters: "_models.CapacityReservationUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.CapacityReservation"]: + """The operation to update a capacity reservation. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. + :type parameters: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + 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) + + 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 + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + capacity_reservation_group_name: str, + capacity_reservation_name: str, + **kwargs: Any + ) -> AsyncLROPoller[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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. + :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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + 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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. + :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. Default value is None. + :type expand: str or + ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.CapacityReservation + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CapacityReservation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore + + + @distributed_trace + def list_by_capacity_reservation_group( + self, + resource_group_name: str, + capacity_reservation_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :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.v2022_03_01.models.CapacityReservationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_dedicated_host_groups_operations.py new file mode 100644 index 000000000000..b9df5c09479c --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_dedicated_host_groups_operations.py @@ -0,0 +1,453 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +from azure.core.rest import HttpRequest +from azure.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]] + +class DedicatedHostGroupsOperations: + """DedicatedHostGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def create_or_update( + self, + 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). + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + 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. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroupUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + 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. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param expand: The expand expression to apply on the operation. '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. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DedicatedHostGroupListResult"]: + """Lists all of the dedicated host groups in the specified resource group. Use the nextLink + property in the response to get the next page of dedicated host groups. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups"} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.DedicatedHostGroupListResult"]: + """Lists all of the dedicated host groups in the subscription. Use the nextLink property in the + response to get the next page of dedicated host groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_dedicated_hosts_operations.py new file mode 100644 index 000000000000..58e577dc1a45 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_dedicated_hosts_operations.py @@ -0,0 +1,688 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +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_restart_request_initial, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DedicatedHostsOperations: + """DedicatedHostsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs: Any + ) -> AsyncLROPoller["_models.DedicatedHost"]: + """Create or update a dedicated host . + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host . + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHost + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DedicatedHost', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.DedicatedHost"]: + """Update an dedicated host . + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host . + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DedicatedHost', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a dedicated host. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host. + :type host_name: str + :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the list of instance views of the dedicated host. 'UserData' is not supported for dedicated + host. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHost, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + + + @distributed_trace + def list_by_host_group( + self, + resource_group_name: str, + host_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DedicatedHostListResult"]: + """Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink + property in the response to get the next page of dedicated hosts. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.DedicatedHostListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_host_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts"} # type: ignore + + async def _restart_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_restart_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._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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart"} # type: ignore + + + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restart the dedicated host. The operation will complete successfully once the dedicated host + has restarted and is running. To determine the health of VMs deployed on the dedicated host + after the restart check the Resource Health Center in the Azure Portal. Please refer to + https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more + details. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + 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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_images_operations.py new file mode 100644 index 000000000000..c442efa70fe4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_images_operations.py @@ -0,0 +1,616 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +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]] + +class ImagesOperations: + """ImagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Image', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs: Any + ) -> AsyncLROPoller["_models.Image"]: + """Create or update an image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.Image + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.Image] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Image', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Image', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.Image"]: + """Update an image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.ImageUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.Image] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Image', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an Image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + image_name=image_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.Image + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ImageListResult"]: + """Gets the list of images under a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ImageListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.ImageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images"} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ImageListResult"]: + """Gets the list of Images in the subscription. Use nextLink property in the response to get the + next page of Images. Do this till nextLink is null to fetch all the Images. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ImageListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.ImageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_log_analytics_operations.py new file mode 100644 index 000000000000..a50e77b09849 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_log_analytics_operations.py @@ -0,0 +1,288 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 +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]] + +class LogAnalyticsOperations: + """LogAnalyticsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _export_request_rate_by_interval_initial( + self, + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _export_request_rate_by_interval_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval"} # type: ignore + + + @distributed_trace_async + async def begin_export_request_rate_by_interval( + self, + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs: Any + ) -> AsyncLROPoller["_models.LogAnalyticsOperationResult"]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The location upon which virtual-machine-sizes is queried. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.RequestRateByIntervalInput + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._export_request_rate_by_interval_initial( + location=location, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_export_request_rate_by_interval.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval"} # type: ignore + + async def _export_throttled_requests_initial( + self, + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _export_throttled_requests_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore + + + @distributed_trace_async + async def begin_export_throttled_requests( + self, + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs: Any + ) -> AsyncLROPoller["_models.LogAnalyticsOperationResult"]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The location upon which virtual-machine-sizes is queried. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getThrottledRequests Api. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.ThrottledRequestsInput + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._export_throttled_requests_initial( + location=location, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_operations.py new file mode 100644 index 000000000000..6baf026bf4ed --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_operations.py @@ -0,0 +1,116 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.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]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ComputeOperationListResult"]: + """Gets a list of compute operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ComputeOperationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.ComputeOperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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) + + else: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.Compute/operations"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_proximity_placement_groups_operations.py new file mode 100644 index 000000000000..663343c9fdcb --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_proximity_placement_groups_operations.py @@ -0,0 +1,448 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.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]] + +class ProximityPlacementGroupsOperations: + """ProximityPlacementGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def create_or_update( + self, + 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. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProximityPlacementGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + 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. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroupUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProximityPlacementGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + 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. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param include_colocation_status: includeColocationStatus=true enables fetching the colocation + status of all the resources in the proximity placement group. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ProximityPlacementGroupListResult"]: + """Lists all proximity placement groups in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ProximityPlacementGroupListResult"]: + """Lists all proximity placement groups in a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ProximityPlacementGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_restore_point_collections_operations.py new file mode 100644 index 000000000000..1fe8fe0a9777 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_restore_point_collections_operations.py @@ -0,0 +1,506 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +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]] + +class RestorePointCollectionsOperations: + """RestorePointCollectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def create_or_update( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestorePointCollection, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RestorePointCollection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RestorePointCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + 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. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollectionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestorePointCollection, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorePointCollection', pipeline_response) + + if cls: + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + restore_point_collection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the restore point collection. This operation will also delete all the + contained restore points. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the Restore Point Collection. + :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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :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. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorePointCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_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.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.RestorePointCollectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections"} # type: ignore + + @distributed_trace + def list_all( + self, + **kwargs: Any + ) -> AsyncIterable["_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.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.RestorePointCollectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_restore_points_operations.py new file mode 100644 index 000000000000..a81c8a38ae8b --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_restore_points_operations.py @@ -0,0 +1,353 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 +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]] + +class RestorePointsOperations: + """RestorePointsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_initial( + self, + 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorePoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + parameters: "_models.RestorePoint", + **kwargs: Any + ) -> AsyncLROPoller["_models.RestorePoint"]: + """The operation to create the restore point. Updating properties of an existing restore point is + not allowed. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.RestorePoint + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.RestorePoint] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + 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) + + 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 + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + restore_point_collection_name: str, + restore_point_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the restore point. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the Restore Point Collection. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. + :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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + 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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + restore_point_collection_name: str, + restore_point_name: str, + expand: Optional[Union[str, "_models.RestorePointExpandOptions"]] = None, + **kwargs: Any + ) -> "_models.RestorePoint": + """The operation to get the restore point. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. + :type restore_point_name: str + :param expand: The expand expression to apply on the operation. 'InstanceView' retrieves + information about the run-time state of a restore point. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_01.models.RestorePointExpandOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestorePoint, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RestorePoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = kwargs.pop('api_version', "2022-03-01") # type: 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, + expand=expand, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorePoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_ssh_public_keys_operations.py new file mode 100644 index 000000000000..cdc9fd8d64e2 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_ssh_public_keys_operations.py @@ -0,0 +1,505 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.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]] + +class SshPublicKeysOperations: + """SshPublicKeysOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SshPublicKeysGroupListResult"]: + """Lists all of the SSH public keys in the subscription. Use the nextLink property in the response + to get the next page of SSH public keys. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.SshPublicKeysGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SshPublicKeysGroupListResult"]: + """Lists all of the SSH public keys in the specified resource group. Use the nextLink property in + the response to get the next page of SSH public keys. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.SshPublicKeysGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys"} # type: ignore + + @distributed_trace_async + async def create( + self, + 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. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + 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. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyUpdateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + 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. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore + + + @distributed_trace_async + async def generate_key_pair( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyGenerateKeyPairResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyGenerateKeyPairResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyGenerateKeyPairResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyGenerateKeyPairResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_key_pair.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_usage_operations.py new file mode 100644 index 000000000000..c7a5c859a89b --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_usage_operations.py @@ -0,0 +1,123 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.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]] + +class UsageOperations: + """UsageOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + location: str, + **kwargs: Any + ) -> AsyncIterable["_models.ListUsagesResult"]: + """Gets, for the specified location, the current compute resource usage information as well as the + limits for compute resources under the subscription. + + :param location: The location for which resource usage is queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListUsagesResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.ListUsagesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_extension_images_operations.py new file mode 100644 index 000000000000..e7b4b0975898 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -0,0 +1,242 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 +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]] + +class VirtualMachineExtensionImagesOperations: + """VirtualMachineExtensionImagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + 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. + :type location: str + :param publisher_name: + :type publisher_name: str + :param type: + :type type: str + :param version: + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineExtensionImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtensionImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtensionImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}"} # type: ignore + + + @distributed_trace_async + async def list_types( + self, + 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. + :type location: str + :param publisher_name: + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineExtensionImage, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineExtensionImage"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineExtensionImage]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_types.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types"} # type: ignore + + + @distributed_trace_async + async def list_versions( + self, + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineExtensionImage"]: + """Gets a list of virtual machine extension image versions. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: + :type publisher_name: str + :param type: + :type type: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str + :param top: Default value is None. + :type top: int + :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) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineExtensionImage"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineExtensionImage]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_versions.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_extensions_operations.py new file mode 100644 index 000000000000..b3b9c8ed494b --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_extensions_operations.py @@ -0,0 +1,552 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 +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]] + +class VirtualMachineExtensionsOperations: + """VirtualMachineExtensionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineExtension"]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be created or + updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtension + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineExtension"]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. + :type extension_parameters: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be deleted. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the extension. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace_async + async def list( + self, + 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. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtensionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtensionsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py new file mode 100644 index 000000000000..4490d4986588 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py @@ -0,0 +1,391 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 +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]] + +class VirtualMachineImagesEdgeZoneOperations: + """VirtualMachineImagesEdgeZoneOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + 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. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param version: A valid image SKU version. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}"} # type: ignore + + + @distributed_trace_async + async def list( + self, + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of all virtual machine image versions for the specified location, edge zone, + publisher, offer, and SKU. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :param top: An integer value specifying the number of images to return that matches supplied + 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) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions"} # type: ignore + + + @distributed_trace_async + async def list_offers( + self, + 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. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_offers.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers"} # type: ignore + + + @distributed_trace_async + async def list_publishers( + self, + 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. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_publishers.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers"} # type: ignore + + + @distributed_trace_async + async def list_skus( + self, + 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. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_skus.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_images_operations.py new file mode 100644 index 000000000000..7eadfa215abf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_images_operations.py @@ -0,0 +1,367 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 +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]] + +class VirtualMachineImagesOperations: + """VirtualMachineImagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + 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. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param version: A valid image SKU version. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}"} # type: ignore + + + @distributed_trace_async + async def list( + self, + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of all virtual machine image versions for the specified location, publisher, offer, + and SKU. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :param top: Default value is None. + :type top: int + :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) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions"} # type: ignore + + + @distributed_trace_async + async def list_offers( + self, + 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. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_offers.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers"} # type: ignore + + + @distributed_trace_async + async def list_publishers( + self, + 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. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_publishers.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers"} # type: ignore + + + @distributed_trace_async + async def list_skus( + self, + 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. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_skus.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_run_commands_operations.py new file mode 100644 index 000000000000..294aa8832322 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -0,0 +1,723 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +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]] + +class VirtualMachineRunCommandsOperations: + """VirtualMachineRunCommandsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + location: str, + **kwargs: Any + ) -> AsyncIterable["_models.RunCommandListResult"]: + """Lists all available run commands for a subscription in a location. + + :param location: The location upon which run commands is queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RunCommandListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.RunCommandListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands"} # type: ignore + + @distributed_trace_async + async def get( + self, + 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. + :type location: str + :param command_id: The command id. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandDocument, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RunCommandDocument + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandDocument"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RunCommandDocument', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + *, + 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + + @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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be created or + updated. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + *, + 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + + @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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be updated. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be deleted. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the run command. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineRunCommand + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_virtual_machine.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace + def list_by_virtual_machine( + self, + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineRunCommandsListResult"]: + """The operation to get all run commands of a Virtual Machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the run command. + :type vm_name: str + :param expand: The expand expression to apply on the operation. 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.v2022_03_01.models.VirtualMachineRunCommandsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_virtual_machine.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py new file mode 100644 index 000000000000..ed94ea5b767b --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -0,0 +1,580 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +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]] + +class VirtualMachineScaleSetExtensionsOperations: + """VirtualMachineScaleSetExtensionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineScaleSetExtension"]: + """The operation to create or update an extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be create or + updated. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. + :type extension_parameters: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtension + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineScaleSetExtension"]: + """The operation to update an extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be updated. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. + :type extension_parameters: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtensionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be deleted. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set containing the extension. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineScaleSetExtensionListResult"]: + """Gets a list of all extensions in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set containing the extension. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtensionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py new file mode 100644 index 000000000000..48e89b909d51 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -0,0 +1,420 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 +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]] + +class VirtualMachineScaleSetRollingUpgradesOperations: + """VirtualMachineScaleSetRollingUpgradesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _cancel_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._cancel_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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _cancel_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore + + + @distributed_trace_async + async def begin_cancel( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Cancels the current virtual machine scale set rolling upgrade. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._cancel_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore + + async def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_os_upgrade_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore + + + @distributed_trace_async + async def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts a rolling upgrade to move all virtual machine scale set instances to the latest + available Platform Image OS version. Instances which are already running the latest available + OS version are not affected. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_os_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_extension_upgrade_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore + + + @distributed_trace_async + async def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to + the latest available extension version. Instances which are already running the latest + extension versions are not affected. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_extension_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RollingUpgradeStatusInfo, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RollingUpgradeStatusInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RollingUpgradeStatusInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RollingUpgradeStatusInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_latest.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py new file mode 100644 index 000000000000..c4cbf5de5522 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -0,0 +1,578 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 +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]] + +class VirtualMachineScaleSetVMExtensionsOperations: + """VirtualMachineScaleSetVMExtensionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineScaleSetVMExtension"]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. + :type extension_parameters: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMExtension + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineScaleSetVMExtension"]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. + :type extension_parameters: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMExtensionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace_async + async def list( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMExtensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtensionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtensionsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py new file mode 100644 index 000000000000..b061e561de9f --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -0,0 +1,613 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +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]] + +class VirtualMachineScaleSetVMRunCommandsOperations: + """VirtualMachineScaleSetVMRunCommandsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + *, + 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + *, + content_type: Optional[str] = "application/json", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineRunCommand"]: + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + run_command=run_command, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + *, + 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + *, + content_type: Optional[str] = "application/json", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineRunCommand"]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + run_command=run_command, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineRunCommand + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineRunCommandsListResult"]: + """The operation to get all run commands of an instance in Virtual Machine Scaleset. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. 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.v2022_03_01.models.VirtualMachineRunCommandsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py new file mode 100644 index 000000000000..7e9cd8df071e --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -0,0 +1,1706 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +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: # pylint: disable=too-many-public-methods + """VirtualMachineScaleSetVMsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _reimage_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_scale_set_vm_reimage_input is not None: + _json = self._serialize.body(vm_scale_set_vm_reimage_input, 'VirtualMachineScaleSetVMReimageParameters') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage"} # type: ignore + + + @distributed_trace_async + async def begin_reimage( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Default value is None. + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMReimageParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_all_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall"} # type: ignore + + + @distributed_trace_async + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. + This operation is only supported for managed disks. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate"} # type: ignore + + + @distributed_trace_async + async def begin_deallocate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and + releases the compute resources it uses. You are not billed for the compute resources of this + virtual machine once it is deallocated. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineScaleSetVM"]: + """Updates a virtual machine of a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be create or + updated. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVM + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a virtual machine from a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param force_deletion: Optional parameter to force delete a virtual machine from a VM scale + set. (Feature in Preview). 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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + force_deletion=force_deletion, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual + machine. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVM, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVM + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}"} # type: ignore + + + @distributed_trace_async + async def get_instance_view( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVMInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineScaleSetVMListResult"]: + """Gets a list of all virtual machines in a VM scale sets. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the VM scale set. + :type virtual_machine_scale_set_name: str + :param filter: The filter to apply to the operation. Allowed values are + 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied + eq true', 'properties/latestModelApplied eq false'. 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'. 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.v2022_03_01.models.VirtualMachineScaleSetVMListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines"} # type: ignore + + async def _power_off_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore + + + @distributed_trace_async + async def begin_power_off( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached + and you are getting charged for the resources. Instead, use deallocate to release resources and + avoid charges. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. 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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + skip_shutdown=skip_shutdown, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore + + async def _restart_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore + + + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore + + + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore + + async def _redeploy_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore + + + @distributed_trace_async + async def begin_redeploy( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and + powers it back on. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with + a value between 1 to 1440 minutes. :code:`
`:code:`
`NOTE: If not specified, SAS URIs + will be generated with a default expiration duration of 120 minutes. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RetrieveBootDiagnosticsDataResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RetrieveBootDiagnosticsDataResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RetrieveBootDiagnosticsDataResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData"} # type: ignore + + + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore + + + @distributed_trace_async + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Performs maintenance on a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore + + @distributed_trace_async + async def simulate_eviction( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + simulate_eviction.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction"} # type: ignore + + + async def _run_command_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + *, + 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore + + + @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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. + :type parameters: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._run_command_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RunCommandResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_sets_operations.py new file mode 100644 index 000000000000..4075881111b0 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -0,0 +1,2399 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +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: # pylint: disable=too-many-public-methods + """VirtualMachineScaleSetsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_location( + self, + location: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineScaleSetListResult"]: + """Gets all the VM scale sets under the specified subscription for the specified location. + + :param location: The location for which VM scale sets under the subscription are queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets"} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineScaleSet"]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The scale set object. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineScaleSet"]: + """Update a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The scale set object. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param force_deletion: Optional parameter to force delete a VM scale set. (Feature in Preview). + 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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + force_deletion=force_deletion, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param expand: The expand expression to apply on the operation. 'UserData' retrieves the + UserData property of the VM scale set that was provided by the user during the VM scale set + Create/Update operation. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_01.models.ExpandTypesForGetVMScaleSets + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + + + async def _deallocate_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore + + + @distributed_trace_async + async def begin_deallocate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and + releases the compute resources. You are not billed for the compute resources that this virtual + machine scale set deallocates. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore + + + @distributed_trace_async + async def begin_delete_instances( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :param force_deletion: Optional parameter to force delete virtual machines from the 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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + force_deletion=force_deletion, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineScaleSetListResult"]: + """Gets a list of all VM scale sets under a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets"} # type: ignore + + @distributed_trace + def list_all( + self, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineScaleSetListWithLinkResult"]: + """Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource + group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this + till nextLink is null to fetch all the VM Scale Sets. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetListWithLinkResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets"} # type: ignore + + @distributed_trace + def list_skus( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineScaleSetListSkusResult"]: + """Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM + instances allowed for each SKU. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetListSkusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_skus.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus"} # type: ignore + + @distributed_trace + def get_os_upgrade_history( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: + """Gets list of OS upgrades on a VM scale set instance. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + get_os_upgrade_history.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory"} # type: ignore + + async def _power_off_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore + + + @distributed_trace_async + async def begin_power_off( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still + attached and you are getting charged for the resources. Instead, use deallocate to release + resources and avoid charges. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. 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. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + skip_shutdown=skip_shutdown, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore + + + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore + + + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore + + + @distributed_trace_async + async def begin_redeploy( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, + and powers them back on. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore + + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore + + + @distributed_trace_async + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances + which are not eligible for perform maintenance will be failed. Please refer to best practices + for more details: + https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore + + async def _update_instances_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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_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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore + + + @distributed_trace_async + async def begin_update_instances( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_scale_set_reimage_input is not None: + _json = self._serialize.body(vm_scale_set_reimage_input, 'VirtualMachineScaleSetReimageParameters') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore + + + @distributed_trace_async + async def begin_reimage( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which + don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual + machine is reset to initial state. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetReimageParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_scale_set_reimage_input=vm_scale_set_reimage_input, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore + + async def _reimage_all_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_all_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall"} # type: ignore + + + @distributed_trace_async + async def begin_reimage_all( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This + operation is only supported for managed disks. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + vm_scale_set_name: str, + platform_update_domain: int, + zone: Optional[str] = None, + placement_group_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": + """Manual platform update domain walk to update virtual machines in a service fabric virtual + machine scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param platform_update_domain: The platform update domain for which a manual recovery walk is + requested. + :type platform_update_domain: int + :param zone: The zone in which the manual recovery walk is requested for cross zone virtual + machine scale set. Default value is None. + :type zone: str + :param placement_group_id: The placement group id for which the manual recovery walk is + requested. Default value is None. + :type placement_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecoveryWalkResponse, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RecoveryWalkResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryWalkResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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, + zone=zone, + placement_group_id=placement_group_id, + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecoveryWalkResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk"} # type: ignore + + + @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, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The input object for ConvertToSinglePlacementGroup API. + :type parameters: + ~azure.mgmt.compute.v2022_03_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + convert_to_single_placement_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup"} # type: ignore + + + async def _set_orchestration_service_state_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _set_orchestration_service_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore + + + @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, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The input object for SetOrchestrationServiceState API. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.OrchestrationServiceStateInput + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._set_orchestration_service_state_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_sizes_operations.py new file mode 100644 index 000000000000..343fef75abdc --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machine_sizes_operations.py @@ -0,0 +1,124 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.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]] + +class VirtualMachineSizesOperations: + """VirtualMachineSizesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + location: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineSizeListResult"]: + """This API is deprecated. Use `Resources Skus + `_. + + :param location: The location upon which virtual-machine-sizes is queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machines_operations.py new file mode 100644 index 000000000000..c79f82f2f091 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/aio/operations/_virtual_machines_operations.py @@ -0,0 +1,2519 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, 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 +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: # pylint: disable=too-many-public-methods + """VirtualMachinesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_location( + self, + location: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineListResult"]: + """Gets all the virtual machines under the specified subscription for the specified location. + + :param location: The location for which virtual machines under the subscription are queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines"} # type: ignore + + async def _capture_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineCaptureResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _capture_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore + + + @distributed_trace_async + async def begin_capture( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineCaptureResult"]: + """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used + to create similar VMs. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineCaptureParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._capture_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineCaptureResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_capture.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachine"]: + """The operation to create or update a virtual machine. Please note some properties can be set + only during virtual machine creation. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachine + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachine', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachine"]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachine', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param force_deletion: Optional parameter to force delete virtual machines. 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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + force_deletion=force_deletion, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param expand: The expand expression to apply on the operation. 'InstanceView' retrieves a + 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.v2022_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachine, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachine + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore + + + @distributed_trace_async + async def instance_view( + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore + + + async def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _convert_to_managed_disks_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks"} # type: ignore + + + @distributed_trace_async + async def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be + stop-deallocated before invoking this operation. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._convert_to_managed_disks_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore + + + @distributed_trace_async + async def begin_deallocate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + hibernate: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Shuts down the virtual machine and releases the compute resources. You are not billed for the + compute resources that this virtual machine uses. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._deallocate_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + hibernate=hibernate, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore + + @distributed_trace_async + async def generalize( # pylint: disable=inconsistent-return-statements + self, + 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 + `_.:code:`
`For + Linux, please refer to `How to create an image of a virtual machine or VHD + `_. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + generalize.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineListResult"]: + """Lists all of the virtual machines in the specified resource group. Use the nextLink property in + the response to get the next page of virtual machines. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param filter: The system query option to filter VMs returned in the response. Allowed value is + 'virtualMachineScaleSet/id' eq + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines"} # type: ignore + + @distributed_trace + def list_all( + self, + status_only: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineListResult"]: + """Lists all of the virtual machines in the specified subscription. Use the nextLink property in + the response to get the next page of virtual machines. + + :param status_only: statusOnly=true enables fetching run time status of all Virtual Machines in + the subscription. Default value is None. + :type status_only: str + :param filter: The system query option to filter VMs returned in the response. Allowed value is + 'virtualMachineScaleSet/id' eq + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + status_only=status_only, + filter=filter, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + status_only=status_only, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines"} # type: ignore + + @distributed_trace + def list_available_sizes( + self, + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualMachineSizeListResult"]: + """Lists all available virtual machine sizes to which the specified virtual machine can be + resized. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_available_sizes.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes"} # type: ignore + + async def _power_off_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore + + + @distributed_trace_async + async def begin_power_off( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to power off (stop) a virtual machine. The virtual machine can be restarted with + the same provisioned resources. You are still charged for this virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. 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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + skip_shutdown=skip_shutdown, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore + + async def _reapply_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reapply_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore + + + @distributed_trace_async + async def begin_reapply( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to reapply a virtual machine's state. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reapply_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reapply.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore + + async def _restart_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore + + + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to restart a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore + + + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to start a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore + + + @distributed_trace_async + async def begin_redeploy( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Shuts down the virtual machine, moves it to a new node, and powers it back on. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if parameters is not None: + _json = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore + + + @distributed_trace_async + async def begin_reimage( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. Default value + is None. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineReimageParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with + a value between 1 to 1440 minutes. :code:`
`:code:`
`NOTE: If not specified, SAS URIs + will be generated with a default expiration duration of 120 minutes. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RetrieveBootDiagnosticsDataResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RetrieveBootDiagnosticsDataResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RetrieveBootDiagnosticsDataResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore + + + async def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore + + + @distributed_trace_async + async def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to perform maintenance on a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore + + @distributed_trace_async + async def simulate_eviction( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + simulate_eviction.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction"} # type: ignore + + + async def _assess_patches_initial( + self, + resource_group_name: str, + vm_name: str, + **kwargs: 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineAssessPatchesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _assess_patches_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore + + + @distributed_trace_async + async def begin_assess_patches( + self, + resource_group_name: str, + vm_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineAssessPatchesResult"]: + """Assess patches on the VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineAssessPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._assess_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineAssessPatchesResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_assess_patches.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore + + async def _install_patches_initial( + self, + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineInstallPatchesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _install_patches_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches"} # type: ignore + + + @distributed_trace_async + async def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs: Any + ) -> AsyncLROPoller["_models.VirtualMachineInstallPatchesResult"]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + :type install_patches_input: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineInstallPatchesParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineInstallPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._install_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + install_patches_input=install_patches_input, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineInstallPatchesResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore + + + @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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Run command operation. + :type parameters: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._run_command_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RunCommandResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/__init__.py new file mode 100644 index 000000000000..03bdcbcda691 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/__init__.py @@ -0,0 +1,651 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import 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 ComputeOperationListResult +from ._models_py3 import ComputeOperationValue +from ._models_py3 import DataDisk +from ._models_py3 import DataDiskImage +from ._models_py3 import DedicatedHost +from ._models_py3 import DedicatedHostAllocatableVM +from ._models_py3 import DedicatedHostAvailableCapacity +from ._models_py3 import DedicatedHostGroup +from ._models_py3 import DedicatedHostGroupInstanceView +from ._models_py3 import DedicatedHostGroupListResult +from ._models_py3 import DedicatedHostGroupPropertiesAdditionalCapabilities +from ._models_py3 import DedicatedHostGroupUpdate +from ._models_py3 import DedicatedHostInstanceView +from ._models_py3 import DedicatedHostInstanceViewWithName +from ._models_py3 import DedicatedHostListResult +from ._models_py3 import DedicatedHostUpdate +from ._models_py3 import DiagnosticsProfile +from ._models_py3 import DiffDiskSettings +from ._models_py3 import DisallowedConfiguration +from ._models_py3 import DiskEncryptionSetParameters +from ._models_py3 import DiskEncryptionSettings +from ._models_py3 import DiskInstanceView +from ._models_py3 import DiskRestorePointInstanceView +from ._models_py3 import DiskRestorePointReplicationStatus +from ._models_py3 import ExtendedLocation +from ._models_py3 import HardwareProfile +from ._models_py3 import Image +from ._models_py3 import ImageDataDisk +from ._models_py3 import ImageDisk +from ._models_py3 import ImageListResult +from ._models_py3 import ImageOSDisk +from ._models_py3 import ImageReference +from ._models_py3 import ImageStorageProfile +from ._models_py3 import ImageUpdate +from ._models_py3 import InnerError +from ._models_py3 import InstanceViewStatus +from ._models_py3 import KeyVaultKeyReference +from ._models_py3 import KeyVaultSecretReference +from ._models_py3 import LastPatchInstallationSummary +from ._models_py3 import LinuxConfiguration +from ._models_py3 import LinuxParameters +from ._models_py3 import LinuxPatchSettings +from ._models_py3 import LinuxVMGuestPatchAutomaticByPlatformSettings +from ._models_py3 import ListUsagesResult +from ._models_py3 import LogAnalyticsInputBase +from ._models_py3 import LogAnalyticsOperationResult +from ._models_py3 import LogAnalyticsOutput +from ._models_py3 import MaintenanceRedeployStatus +from ._models_py3 import ManagedDiskParameters +from ._models_py3 import NetworkInterfaceReference +from ._models_py3 import NetworkProfile +from ._models_py3 import OSDisk +from ._models_py3 import OSDiskImage +from ._models_py3 import OSProfile +from ._models_py3 import OrchestrationServiceStateInput +from ._models_py3 import OrchestrationServiceSummary +from ._models_py3 import PatchInstallationDetail +from ._models_py3 import PatchSettings +from ._models_py3 import Plan +from ._models_py3 import ProximityPlacementGroup +from ._models_py3 import ProximityPlacementGroupListResult +from ._models_py3 import ProximityPlacementGroupPropertiesIntent +from ._models_py3 import ProximityPlacementGroupUpdate +from ._models_py3 import ProxyResource +from ._models_py3 import PublicIPAddressSku +from ._models_py3 import PurchasePlan +from ._models_py3 import RecoveryWalkResponse +from ._models_py3 import RequestRateByIntervalInput +from ._models_py3 import Resource +from ._models_py3 import ResourceWithOptionalLocation +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 RestorePointInstanceView +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 Sku +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 TerminateNotificationProfile +from ._models_py3 import ThrottledRequestsInput +from ._models_py3 import UefiSettings +from ._models_py3 import UpdateResource +from ._models_py3 import UpgradeOperationHistoricalStatusInfo +from ._models_py3 import UpgradeOperationHistoricalStatusInfoProperties +from ._models_py3 import UpgradeOperationHistoryStatus +from ._models_py3 import UpgradePolicy +from ._models_py3 import Usage +from ._models_py3 import UsageName +from ._models_py3 import UserAssignedIdentitiesValue +from ._models_py3 import VMDiskSecurityProfile +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 VirtualMachineScaleSetHardwareProfile +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 ._models_py3 import WindowsVMGuestPatchAutomaticByPlatformSettings + + +from ._compute_management_client_enums import ( + ArchitectureTypes, + AvailabilitySetSkuTypes, + CachingTypes, + CapacityReservationGroupInstanceViewTypes, + CapacityReservationInstanceViewTypes, + ConsistencyModeTypes, + DedicatedHostLicenseTypes, + DeleteOptions, + DiffDiskOptions, + DiffDiskPlacement, + DiskCreateOptionTypes, + DiskDeleteOptionTypes, + DiskDetachOptionTypes, + ExecutionState, + ExpandTypesForGetCapacityReservationGroups, + ExpandTypesForGetVMScaleSets, + ExtendedLocationTypes, + HyperVGenerationType, + HyperVGenerationTypes, + IPVersion, + IPVersions, + InstanceViewTypes, + IntervalInMins, + LinuxPatchAssessmentMode, + LinuxVMGuestPatchAutomaticByPlatformRebootSetting, + LinuxVMGuestPatchMode, + MaintenanceOperationResultCodeTypes, + NetworkApiVersion, + OperatingSystemStateTypes, + OperatingSystemType, + OperatingSystemTypes, + OrchestrationMode, + OrchestrationServiceNames, + OrchestrationServiceState, + OrchestrationServiceStateAction, + PatchAssessmentState, + PatchInstallationState, + PatchOperationStatus, + ProtocolTypes, + ProximityPlacementGroupType, + PublicIPAddressSkuName, + PublicIPAddressSkuTier, + PublicIPAllocationMethod, + RepairAction, + ResourceIdentityType, + RestorePointCollectionExpandOptions, + RestorePointExpandOptions, + RollingUpgradeActionType, + RollingUpgradeStatusCode, + SecurityEncryptionTypes, + SecurityTypes, + SettingNames, + StatusLevelTypes, + StorageAccountTypes, + UpgradeMode, + UpgradeOperationInvoker, + UpgradeState, + VMGuestPatchClassificationLinux, + VMGuestPatchClassificationWindows, + VMGuestPatchRebootBehavior, + VMGuestPatchRebootSetting, + VMGuestPatchRebootStatus, + VirtualMachineEvictionPolicyTypes, + VirtualMachinePriorityTypes, + VirtualMachineScaleSetScaleInRules, + VirtualMachineScaleSetSkuScaleType, + VirtualMachineSizeTypes, + VmDiskTypes, + WindowsPatchAssessmentMode, + WindowsVMGuestPatchAutomaticByPlatformRebootSetting, + WindowsVMGuestPatchMode, +) + +__all__ = [ + 'AdditionalCapabilities', + 'AdditionalUnattendContent', + 'ApiEntityReference', + 'ApiError', + 'ApiErrorBase', + 'ApplicationProfile', + 'AutomaticOSUpgradePolicy', + 'AutomaticOSUpgradeProperties', + 'AutomaticRepairsPolicy', + 'AvailabilitySet', + 'AvailabilitySetListResult', + 'AvailabilitySetUpdate', + 'AvailablePatchSummary', + 'BillingProfile', + 'BootDiagnostics', + 'BootDiagnosticsInstanceView', + 'CapacityReservation', + 'CapacityReservationGroup', + 'CapacityReservationGroupInstanceView', + 'CapacityReservationGroupListResult', + 'CapacityReservationGroupUpdate', + 'CapacityReservationInstanceView', + 'CapacityReservationInstanceViewWithName', + 'CapacityReservationListResult', + 'CapacityReservationProfile', + 'CapacityReservationUpdate', + 'CapacityReservationUtilization', + 'ComputeOperationListResult', + 'ComputeOperationValue', + 'DataDisk', + 'DataDiskImage', + 'DedicatedHost', + 'DedicatedHostAllocatableVM', + 'DedicatedHostAvailableCapacity', + 'DedicatedHostGroup', + 'DedicatedHostGroupInstanceView', + 'DedicatedHostGroupListResult', + 'DedicatedHostGroupPropertiesAdditionalCapabilities', + 'DedicatedHostGroupUpdate', + 'DedicatedHostInstanceView', + 'DedicatedHostInstanceViewWithName', + 'DedicatedHostListResult', + 'DedicatedHostUpdate', + 'DiagnosticsProfile', + 'DiffDiskSettings', + 'DisallowedConfiguration', + 'DiskEncryptionSetParameters', + 'DiskEncryptionSettings', + 'DiskInstanceView', + 'DiskRestorePointInstanceView', + 'DiskRestorePointReplicationStatus', + 'ExtendedLocation', + 'HardwareProfile', + 'Image', + 'ImageDataDisk', + 'ImageDisk', + 'ImageListResult', + 'ImageOSDisk', + 'ImageReference', + 'ImageStorageProfile', + 'ImageUpdate', + 'InnerError', + 'InstanceViewStatus', + 'KeyVaultKeyReference', + 'KeyVaultSecretReference', + 'LastPatchInstallationSummary', + 'LinuxConfiguration', + 'LinuxParameters', + 'LinuxPatchSettings', + 'LinuxVMGuestPatchAutomaticByPlatformSettings', + 'ListUsagesResult', + 'LogAnalyticsInputBase', + 'LogAnalyticsOperationResult', + 'LogAnalyticsOutput', + 'MaintenanceRedeployStatus', + 'ManagedDiskParameters', + 'NetworkInterfaceReference', + 'NetworkProfile', + 'OSDisk', + 'OSDiskImage', + 'OSProfile', + 'OrchestrationServiceStateInput', + 'OrchestrationServiceSummary', + 'PatchInstallationDetail', + 'PatchSettings', + 'Plan', + 'ProximityPlacementGroup', + 'ProximityPlacementGroupListResult', + 'ProximityPlacementGroupPropertiesIntent', + 'ProximityPlacementGroupUpdate', + 'ProxyResource', + 'PublicIPAddressSku', + 'PurchasePlan', + 'RecoveryWalkResponse', + 'RequestRateByIntervalInput', + 'Resource', + 'ResourceWithOptionalLocation', + 'RestorePoint', + 'RestorePointCollection', + 'RestorePointCollectionListResult', + 'RestorePointCollectionSourceProperties', + 'RestorePointCollectionUpdate', + 'RestorePointInstanceView', + 'RestorePointSourceMetadata', + 'RestorePointSourceVMDataDisk', + 'RestorePointSourceVMOSDisk', + 'RestorePointSourceVMStorageProfile', + 'RetrieveBootDiagnosticsDataResult', + 'RollbackStatusInfo', + 'RollingUpgradePolicy', + 'RollingUpgradeProgressInfo', + 'RollingUpgradeRunningStatus', + 'RollingUpgradeStatusInfo', + 'RunCommandDocument', + 'RunCommandDocumentBase', + 'RunCommandInput', + 'RunCommandInputParameter', + 'RunCommandListResult', + 'RunCommandParameterDefinition', + 'RunCommandResult', + 'ScaleInPolicy', + 'ScheduledEventsProfile', + 'SecurityProfile', + 'Sku', + 'SpotRestorePolicy', + 'SshConfiguration', + 'SshPublicKey', + 'SshPublicKeyGenerateKeyPairResult', + 'SshPublicKeyResource', + 'SshPublicKeyUpdateResource', + 'SshPublicKeysGroupListResult', + 'StorageProfile', + 'SubResource', + 'SubResourceReadOnly', + 'SubResourceWithColocationStatus', + 'TerminateNotificationProfile', + 'ThrottledRequestsInput', + 'UefiSettings', + 'UpdateResource', + 'UpgradeOperationHistoricalStatusInfo', + 'UpgradeOperationHistoricalStatusInfoProperties', + 'UpgradeOperationHistoryStatus', + 'UpgradePolicy', + 'Usage', + 'UsageName', + 'UserAssignedIdentitiesValue', + 'VMDiskSecurityProfile', + 'VMGalleryApplication', + 'VMScaleSetConvertToSinglePlacementGroupInput', + 'VMSizeProperties', + 'VaultCertificate', + 'VaultSecretGroup', + 'VirtualHardDisk', + 'VirtualMachine', + 'VirtualMachineAgentInstanceView', + 'VirtualMachineAssessPatchesResult', + 'VirtualMachineCaptureParameters', + 'VirtualMachineCaptureResult', + 'VirtualMachineExtension', + 'VirtualMachineExtensionHandlerInstanceView', + 'VirtualMachineExtensionImage', + 'VirtualMachineExtensionInstanceView', + 'VirtualMachineExtensionUpdate', + 'VirtualMachineExtensionsListResult', + 'VirtualMachineHealthStatus', + 'VirtualMachineIdentity', + 'VirtualMachineImage', + 'VirtualMachineImageFeature', + 'VirtualMachineImageResource', + 'VirtualMachineInstallPatchesParameters', + 'VirtualMachineInstallPatchesResult', + 'VirtualMachineInstanceView', + 'VirtualMachineIpTag', + 'VirtualMachineListResult', + 'VirtualMachineNetworkInterfaceConfiguration', + 'VirtualMachineNetworkInterfaceDnsSettingsConfiguration', + 'VirtualMachineNetworkInterfaceIPConfiguration', + 'VirtualMachinePatchStatus', + 'VirtualMachinePublicIPAddressConfiguration', + 'VirtualMachinePublicIPAddressDnsSettingsConfiguration', + 'VirtualMachineReimageParameters', + 'VirtualMachineRunCommand', + 'VirtualMachineRunCommandInstanceView', + 'VirtualMachineRunCommandScriptSource', + 'VirtualMachineRunCommandUpdate', + 'VirtualMachineRunCommandsListResult', + 'VirtualMachineScaleSet', + 'VirtualMachineScaleSetDataDisk', + 'VirtualMachineScaleSetExtension', + 'VirtualMachineScaleSetExtensionListResult', + 'VirtualMachineScaleSetExtensionProfile', + 'VirtualMachineScaleSetExtensionUpdate', + 'VirtualMachineScaleSetHardwareProfile', + 'VirtualMachineScaleSetIPConfiguration', + 'VirtualMachineScaleSetIdentity', + 'VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue', + 'VirtualMachineScaleSetInstanceView', + 'VirtualMachineScaleSetInstanceViewStatusesSummary', + 'VirtualMachineScaleSetIpTag', + 'VirtualMachineScaleSetListOSUpgradeHistory', + 'VirtualMachineScaleSetListResult', + 'VirtualMachineScaleSetListSkusResult', + 'VirtualMachineScaleSetListWithLinkResult', + 'VirtualMachineScaleSetManagedDiskParameters', + 'VirtualMachineScaleSetNetworkConfiguration', + 'VirtualMachineScaleSetNetworkConfigurationDnsSettings', + 'VirtualMachineScaleSetNetworkProfile', + 'VirtualMachineScaleSetOSDisk', + 'VirtualMachineScaleSetOSProfile', + 'VirtualMachineScaleSetPublicIPAddressConfiguration', + 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings', + 'VirtualMachineScaleSetReimageParameters', + 'VirtualMachineScaleSetSku', + 'VirtualMachineScaleSetSkuCapacity', + 'VirtualMachineScaleSetStorageProfile', + 'VirtualMachineScaleSetUpdate', + 'VirtualMachineScaleSetUpdateIPConfiguration', + 'VirtualMachineScaleSetUpdateNetworkConfiguration', + 'VirtualMachineScaleSetUpdateNetworkProfile', + 'VirtualMachineScaleSetUpdateOSDisk', + 'VirtualMachineScaleSetUpdateOSProfile', + 'VirtualMachineScaleSetUpdatePublicIPAddressConfiguration', + 'VirtualMachineScaleSetUpdateStorageProfile', + 'VirtualMachineScaleSetUpdateVMProfile', + 'VirtualMachineScaleSetVM', + 'VirtualMachineScaleSetVMExtension', + 'VirtualMachineScaleSetVMExtensionUpdate', + 'VirtualMachineScaleSetVMExtensionsListResult', + 'VirtualMachineScaleSetVMExtensionsSummary', + 'VirtualMachineScaleSetVMInstanceIDs', + 'VirtualMachineScaleSetVMInstanceRequiredIDs', + 'VirtualMachineScaleSetVMInstanceView', + 'VirtualMachineScaleSetVMListResult', + 'VirtualMachineScaleSetVMNetworkProfileConfiguration', + 'VirtualMachineScaleSetVMProfile', + 'VirtualMachineScaleSetVMProtectionPolicy', + 'VirtualMachineScaleSetVMReimageParameters', + 'VirtualMachineSize', + 'VirtualMachineSizeListResult', + 'VirtualMachineSoftwarePatchProperties', + 'VirtualMachineStatusCodeCount', + 'VirtualMachineUpdate', + 'WinRMConfiguration', + 'WinRMListener', + 'WindowsConfiguration', + 'WindowsParameters', + 'WindowsVMGuestPatchAutomaticByPlatformSettings', + 'ArchitectureTypes', + 'AvailabilitySetSkuTypes', + 'CachingTypes', + 'CapacityReservationGroupInstanceViewTypes', + 'CapacityReservationInstanceViewTypes', + 'ConsistencyModeTypes', + 'DedicatedHostLicenseTypes', + 'DeleteOptions', + 'DiffDiskOptions', + 'DiffDiskPlacement', + 'DiskCreateOptionTypes', + 'DiskDeleteOptionTypes', + 'DiskDetachOptionTypes', + 'ExecutionState', + 'ExpandTypesForGetCapacityReservationGroups', + 'ExpandTypesForGetVMScaleSets', + 'ExtendedLocationTypes', + 'HyperVGenerationType', + 'HyperVGenerationTypes', + 'IPVersion', + 'IPVersions', + 'InstanceViewTypes', + 'IntervalInMins', + 'LinuxPatchAssessmentMode', + 'LinuxVMGuestPatchAutomaticByPlatformRebootSetting', + 'LinuxVMGuestPatchMode', + 'MaintenanceOperationResultCodeTypes', + 'NetworkApiVersion', + 'OperatingSystemStateTypes', + 'OperatingSystemType', + 'OperatingSystemTypes', + 'OrchestrationMode', + 'OrchestrationServiceNames', + 'OrchestrationServiceState', + 'OrchestrationServiceStateAction', + 'PatchAssessmentState', + 'PatchInstallationState', + 'PatchOperationStatus', + 'ProtocolTypes', + 'ProximityPlacementGroupType', + 'PublicIPAddressSkuName', + 'PublicIPAddressSkuTier', + 'PublicIPAllocationMethod', + 'RepairAction', + 'ResourceIdentityType', + 'RestorePointCollectionExpandOptions', + 'RestorePointExpandOptions', + 'RollingUpgradeActionType', + 'RollingUpgradeStatusCode', + 'SecurityEncryptionTypes', + 'SecurityTypes', + 'SettingNames', + 'StatusLevelTypes', + 'StorageAccountTypes', + 'UpgradeMode', + 'UpgradeOperationInvoker', + 'UpgradeState', + 'VMGuestPatchClassificationLinux', + 'VMGuestPatchClassificationWindows', + 'VMGuestPatchRebootBehavior', + 'VMGuestPatchRebootSetting', + 'VMGuestPatchRebootStatus', + 'VirtualMachineEvictionPolicyTypes', + 'VirtualMachinePriorityTypes', + 'VirtualMachineScaleSetScaleInRules', + 'VirtualMachineScaleSetSkuScaleType', + 'VirtualMachineSizeTypes', + 'VmDiskTypes', + 'WindowsPatchAssessmentMode', + 'WindowsVMGuestPatchAutomaticByPlatformRebootSetting', + 'WindowsVMGuestPatchMode', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/_compute_management_client_enums.py new file mode 100644 index 000000000000..ed4365b70071 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/_compute_management_client_enums.py @@ -0,0 +1,802 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class ArchitectureTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the Architecture Type + """ + + X64 = "x64" + ARM64 = "Arm64" + +class AvailabilitySetSkuTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the sku of an Availability Set. Use 'Aligned' for virtual machines with managed disks + and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'. + """ + + CLASSIC = "Classic" + ALIGNED = "Aligned" + +class CachingTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the caching requirements. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage** + """ + + NONE = "None" + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + +class CapacityReservationGroupInstanceViewTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + INSTANCE_VIEW = "instanceView" + +class CapacityReservationInstanceViewTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + INSTANCE_VIEW = "instanceView" + +class ConsistencyModeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """ConsistencyMode of the RestorePoint. Can be specified in the input while creating a restore + point. For now, only CrashConsistent is accepted as a valid input. Please refer to + https://aka.ms/RestorePoints for more details. + """ + + CRASH_CONSISTENT = "CrashConsistent" + FILE_SYSTEM_CONSISTENT = "FileSystemConsistent" + APPLICATION_CONSISTENT = "ApplicationConsistent" + +class DedicatedHostLicenseTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the software license type that will be applied to the VMs deployed on the dedicated + host. :code:`
`:code:`
` Possible values are: :code:`
`:code:`
` **None** + :code:`
`:code:`
` **Windows_Server_Hybrid** :code:`
`:code:`
` + **Windows_Server_Perpetual** :code:`
`:code:`
` Default: **None** + """ + + NONE = "None" + WINDOWS_SERVER_HYBRID = "Windows_Server_Hybrid" + WINDOWS_SERVER_PERPETUAL = "Windows_Server_Perpetual" + +class 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)): + """Specifies the ephemeral disk option for operating system disk. + """ + + LOCAL = "Local" + +class DiffDiskPlacement(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the ephemeral disk placement for operating system disk. This property can be used by + user in the request to choose the location i.e, cache disk or resource disk space for Ephemeral + OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer + Ephemeral OS disk size requirements for Windows VM at + https://docs.microsoft.com/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements + and Linux VM at + https://docs.microsoft.com/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements + """ + + CACHE_DISK = "CacheDisk" + RESOURCE_DISK = "ResourceDisk" + +class DiskCreateOptionTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies how the virtual machine should be created.:code:`
`:code:`
` Possible values + are::code:`
`:code:`
` **Attach** \u2013 This value is used when you are using a + specialized disk to create the virtual machine.:code:`
`:code:`
` **FromImage** \u2013 + This value is used when you are using an image to create the virtual machine. If you are using + a platform image, you also use the imageReference element described above. If you are using a + marketplace image, you also use the plan element previously described. + """ + + FROM_IMAGE = "FromImage" + EMPTY = "Empty" + ATTACH = "Attach" + +class 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** + If this value is used, the managed disk is retained after VM gets + deleted.:code:`
`:code:`
` Minimum api-version: 2021-03-01 + """ + + DELETE = "Delete" + DETACH = "Detach" + +class DiskDetachOptionTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the detach behavior to be used while detaching a disk or which is already in the + process of detachment from the virtual machine. Supported values: **ForceDetach**. + :code:`
`:code:`
` detachOption: **ForceDetach** is applicable only for managed data + disks. If a previous detachment attempt of the data disk did not complete due to an unexpected + failure from the virtual machine and the disk is still not released then use force-detach as a + last resort option to detach the disk forcibly from the VM. All writes might not have been + flushed when using this detach behavior. :code:`
`:code:`
` This feature is still in + preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk + update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. + """ + + FORCE_DETACH = "ForceDetach" + +class ExecutionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Script execution status. + """ + + UNKNOWN = "Unknown" + PENDING = "Pending" + RUNNING = "Running" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + TIMED_OUT = "TimedOut" + CANCELED = "Canceled" + +class 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)): + + USER_DATA = "userData" + +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of extendedLocation. + """ + + EDGE_ZONE = "EdgeZone" + +class HyperVGenerationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the HyperVGeneration Type associated with a resource + """ + + V1 = "V1" + V2 = "V2" + +class HyperVGenerationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the HyperVGeneration Type + """ + + V1 = "V1" + V2 = "V2" + +class InstanceViewTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + INSTANCE_VIEW = "instanceView" + USER_DATA = "userData" + +class IntervalInMins(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Interval value in minutes used to create LogAnalytics call rate logs. + """ + + THREE_MINS = "ThreeMins" + FIVE_MINS = "FiveMins" + THIRTY_MINS = "ThirtyMins" + SIXTY_MINS = "SixtyMins" + +class IPVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Available from Api-Version 2017-03-30 onwards, it represents whether the specific + ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and + 'IPv6'. + """ + + I_PV4 = "IPv4" + I_PV6 = "IPv6" + +class 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'. + """ + + I_PV4 = "IPv4" + I_PV6 = "IPv6" + +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:`
` + **AutomaticByPlatform** - The platform will trigger periodic patch assessments. The property + provisionVMAgent must be true. + """ + + IMAGE_DEFAULT = "ImageDefault" + AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" + +class LinuxVMGuestPatchAutomaticByPlatformRebootSetting(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the reboot setting for all AutomaticByPlatform patch installation operations. + """ + + UNKNOWN = "Unknown" + IF_REQUIRED = "IfRequired" + NEVER = "Never" + ALWAYS = "Always" + +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 + default patching configuration is used. :code:`
`:code:`
` **AutomaticByPlatform** - + The virtual machine will be automatically updated by the platform. The property + provisionVMAgent must be true + """ + + IMAGE_DEFAULT = "ImageDefault" + AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" + +class MaintenanceOperationResultCodeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The Last Maintenance Operation Result Code. + """ + + NONE = "None" + RETRY_LATER = "RetryLater" + MAINTENANCE_ABORTED = "MaintenanceAborted" + MAINTENANCE_COMPLETED = "MaintenanceCompleted" + +class 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)): + """The OS State. + """ + + #: Generalized image. Needs to be provisioned during deployment time. + GENERALIZED = "Generalized" + #: Specialized image. Contains already provisioned OS Disk. + SPECIALIZED = "Specialized" + +class OperatingSystemType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the Operating System type. + """ + + WINDOWS = "Windows" + LINUX = "Linux" + +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """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** + """ + + WINDOWS = "Windows" + LINUX = "Linux" + +class OrchestrationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the orchestration mode for the virtual machine scale set. + """ + + UNIFORM = "Uniform" + FLEXIBLE = "Flexible" + +class OrchestrationServiceNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The name of the service. + """ + + AUTOMATIC_REPAIRS = "AutomaticRepairs" + DUMMY_ORCHESTRATION_SERVICE_NAME = "DummyOrchestrationServiceName" + +class OrchestrationServiceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current state of the service. + """ + + NOT_RUNNING = "NotRunning" + RUNNING = "Running" + SUSPENDED = "Suspended" + +class OrchestrationServiceStateAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The action to be performed. + """ + + RESUME = "Resume" + SUSPEND = "Suspend" + +class PatchAssessmentState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Describes the availability of a given patch. + """ + + UNKNOWN = "Unknown" + AVAILABLE = "Available" + +class PatchInstallationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The state of the patch after the installation operation completed. + """ + + UNKNOWN = "Unknown" + INSTALLED = "Installed" + FAILED = "Failed" + EXCLUDED = "Excluded" + NOT_SELECTED = "NotSelected" + PENDING = "Pending" + +class PatchOperationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The overall success or failure status of the operation. It remains "InProgress" until the + operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or + "CompletedWithWarnings." + """ + + UNKNOWN = "Unknown" + IN_PROGRESS = "InProgress" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" + +class ProtocolTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the protocol of WinRM listener. :code:`
`:code:`
` Possible values are: + :code:`
`\ **http** :code:`
`:code:`
` **https** + """ + + HTTP = "Http" + HTTPS = "Https" + +class ProximityPlacementGroupType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the type of the proximity placement group. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **Standard** : Co-locate resources within an Azure region or + Availability Zone. :code:`
`:code:`
` **Ultra** : For future use. + """ + + STANDARD = "Standard" + ULTRA = "Ultra" + +class PublicIPAddressSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specify public IP sku name + """ + + BASIC = "Basic" + STANDARD = "Standard" + +class PublicIPAddressSkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specify public IP sku tier + """ + + REGIONAL = "Regional" + GLOBAL_ENUM = "Global" + +class PublicIPAllocationMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specify the public IP allocation type + """ + + DYNAMIC = "Dynamic" + STATIC = "Static" + +class RepairAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of repair action (replace, restart, reimage) that will be used for repairing unhealthy + virtual machines in the scale set. Default value is replace. + """ + + REPLACE = "Replace" + RESTART = "Restart" + REIMAGE = "Reimage" + +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """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. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class RestorePointCollectionExpandOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + RESTORE_POINTS = "restorePoints" + +class RestorePointExpandOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + INSTANCE_VIEW = "instanceView" + +class RollingUpgradeActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The last action performed on the rolling upgrade. + """ + + START = "Start" + CANCEL = "Cancel" + +class RollingUpgradeStatusCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Code indicating the current status of the upgrade. + """ + + ROLLING_FORWARD = "RollingForward" + CANCELLED = "Cancelled" + COMPLETED = "Completed" + FAULTED = "Faulted" + +class SecurityEncryptionTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the EncryptionType of the managed disk. :code:`
` It is set to + DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob, and + VMGuestStateOnly for encryption of just the VMGuestState blob. :code:`
`:code:`
` NOTE: + It can be set for only Confidential VMs. + """ + + VM_GUEST_STATE_ONLY = "VMGuestStateOnly" + DISK_WITH_VM_GUEST_STATE = "DiskWithVMGuestState" + +class SecurityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the SecurityType of the virtual machine. It has to be set to any specified value to + enable UefiSettings. :code:`
`:code:`
` Default: UefiSettings will not be enabled unless + this property is set. + """ + + TRUSTED_LAUNCH = "TrustedLaunch" + CONFIDENTIAL_VM = "ConfidentialVM" + +class SettingNames(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the name of the setting to which the content applies. Possible values are: + FirstLogonCommands and AutoLogon. + """ + + AUTO_LOGON = "AutoLogon" + FIRST_LOGON_COMMANDS = "FirstLogonCommands" + +class StatusLevelTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The level code. + """ + + INFO = "Info" + WARNING = "Warning" + ERROR = "Error" + +class StorageAccountTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the storage account type for the managed disk. Managed OS disk storage account type + can only be set when you create the scale set. NOTE: UltraSSD_LRS can only be used with data + disks. It cannot be used with OS Disk. Standard_LRS uses Standard HDD. StandardSSD_LRS uses + Standard SSD. Premium_LRS uses Premium SSD. UltraSSD_LRS uses Ultra disk. Premium_ZRS uses + Premium SSD zone redundant storage. StandardSSD_ZRS uses Standard SSD zone redundant storage. + For more information regarding disks supported for Windows Virtual Machines, refer to + https://docs.microsoft.com/azure/virtual-machines/windows/disks-types and, for Linux Virtual + Machines, refer to https://docs.microsoft.com/azure/virtual-machines/linux/disks-types + """ + + STANDARD_LRS = "Standard_LRS" + PREMIUM_LRS = "Premium_LRS" + STANDARD_SSD_LRS = "StandardSSD_LRS" + ULTRA_SSD_LRS = "UltraSSD_LRS" + PREMIUM_ZRS = "Premium_ZRS" + STANDARD_SSD_ZRS = "StandardSSD_ZRS" + PREMIUM_V2_LRS = "PremiumV2_LRS" + +class UpgradeMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the mode of an upgrade to virtual machines in the scale set.:code:`
`:code:`
` Possible values are::code:`
`:code:`
` **Manual** - You control the application + of updates to virtual machines in the scale set. You do this by using the manualUpgrade + action.:code:`
`:code:`
` **Automatic** - All virtual machines in the scale set are + automatically updated at the same time. + """ + + AUTOMATIC = "Automatic" + MANUAL = "Manual" + ROLLING = "Rolling" + +class UpgradeOperationInvoker(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Invoker of the Upgrade Operation + """ + + UNKNOWN = "Unknown" + USER = "User" + PLATFORM = "Platform" + +class UpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Code indicating the current status of the upgrade. + """ + + ROLLING_FORWARD = "RollingForward" + CANCELLED = "Cancelled" + COMPLETED = "Completed" + FAULTED = "Faulted" + +class VirtualMachineEvictionPolicyTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the eviction policy for the Azure Spot VM/VMSS + """ + + DEALLOCATE = "Deallocate" + DELETE = "Delete" + +class VirtualMachinePriorityTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the priority for a standalone virtual machine or the virtual machines in the scale + set. :code:`
`:code:`
` 'Low' enum will be deprecated in the future, please use 'Spot' as + the enum to deploy Azure Spot VM/VMSS. + """ + + REGULAR = "Regular" + LOW = "Low" + SPOT = "Spot" + +class VirtualMachineScaleSetScaleInRules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + DEFAULT = "Default" + OLDEST_VM = "OldestVM" + NEWEST_VM = "NewestVM" + +class VirtualMachineScaleSetSkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The scale type applicable to the sku. + """ + + AUTOMATIC = "Automatic" + NONE = "None" + +class VirtualMachineSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the size of the virtual machine. :code:`
`:code:`
` The enum data type is + currently deprecated and will be removed by December 23rd 2023. :code:`
`:code:`
` + Recommended way to get the list of available sizes is using these APIs: + :code:`
`:code:`
` `List all available virtual machine sizes in an availability set + `_ + :code:`
`:code:`
` `List all available virtual machine sizes in a region + `_ :code:`
`:code:`
` + `List all available virtual machine sizes for resizing + `_. For more + information about virtual machine sizes, see `Sizes for virtual machines + `_. :code:`
`:code:`
` The + available VM sizes depend on region and availability set. + """ + + BASIC_A0 = "Basic_A0" + BASIC_A1 = "Basic_A1" + BASIC_A2 = "Basic_A2" + BASIC_A3 = "Basic_A3" + BASIC_A4 = "Basic_A4" + STANDARD_A0 = "Standard_A0" + STANDARD_A1 = "Standard_A1" + STANDARD_A2 = "Standard_A2" + STANDARD_A3 = "Standard_A3" + STANDARD_A4 = "Standard_A4" + STANDARD_A5 = "Standard_A5" + STANDARD_A6 = "Standard_A6" + STANDARD_A7 = "Standard_A7" + STANDARD_A8 = "Standard_A8" + STANDARD_A9 = "Standard_A9" + STANDARD_A10 = "Standard_A10" + STANDARD_A11 = "Standard_A11" + STANDARD_A1_V2 = "Standard_A1_v2" + STANDARD_A2_V2 = "Standard_A2_v2" + STANDARD_A4_V2 = "Standard_A4_v2" + STANDARD_A8_V2 = "Standard_A8_v2" + STANDARD_A2_M_V2 = "Standard_A2m_v2" + STANDARD_A4_M_V2 = "Standard_A4m_v2" + STANDARD_A8_M_V2 = "Standard_A8m_v2" + STANDARD_B1_S = "Standard_B1s" + STANDARD_B1_MS = "Standard_B1ms" + STANDARD_B2_S = "Standard_B2s" + STANDARD_B2_MS = "Standard_B2ms" + STANDARD_B4_MS = "Standard_B4ms" + STANDARD_B8_MS = "Standard_B8ms" + STANDARD_D1 = "Standard_D1" + STANDARD_D2 = "Standard_D2" + STANDARD_D3 = "Standard_D3" + STANDARD_D4 = "Standard_D4" + STANDARD_D11 = "Standard_D11" + STANDARD_D12 = "Standard_D12" + STANDARD_D13 = "Standard_D13" + STANDARD_D14 = "Standard_D14" + STANDARD_D1_V2 = "Standard_D1_v2" + STANDARD_D2_V2 = "Standard_D2_v2" + STANDARD_D3_V2 = "Standard_D3_v2" + STANDARD_D4_V2 = "Standard_D4_v2" + STANDARD_D5_V2 = "Standard_D5_v2" + STANDARD_D2_V3 = "Standard_D2_v3" + STANDARD_D4_V3 = "Standard_D4_v3" + STANDARD_D8_V3 = "Standard_D8_v3" + STANDARD_D16_V3 = "Standard_D16_v3" + STANDARD_D32_V3 = "Standard_D32_v3" + STANDARD_D64_V3 = "Standard_D64_v3" + STANDARD_D2_S_V3 = "Standard_D2s_v3" + STANDARD_D4_S_V3 = "Standard_D4s_v3" + STANDARD_D8_S_V3 = "Standard_D8s_v3" + STANDARD_D16_S_V3 = "Standard_D16s_v3" + STANDARD_D32_S_V3 = "Standard_D32s_v3" + STANDARD_D64_S_V3 = "Standard_D64s_v3" + STANDARD_D11_V2 = "Standard_D11_v2" + STANDARD_D12_V2 = "Standard_D12_v2" + STANDARD_D13_V2 = "Standard_D13_v2" + STANDARD_D14_V2 = "Standard_D14_v2" + STANDARD_D15_V2 = "Standard_D15_v2" + STANDARD_DS1 = "Standard_DS1" + STANDARD_DS2 = "Standard_DS2" + STANDARD_DS3 = "Standard_DS3" + STANDARD_DS4 = "Standard_DS4" + STANDARD_DS11 = "Standard_DS11" + STANDARD_DS12 = "Standard_DS12" + STANDARD_DS13 = "Standard_DS13" + STANDARD_DS14 = "Standard_DS14" + STANDARD_DS1_V2 = "Standard_DS1_v2" + STANDARD_DS2_V2 = "Standard_DS2_v2" + STANDARD_DS3_V2 = "Standard_DS3_v2" + STANDARD_DS4_V2 = "Standard_DS4_v2" + STANDARD_DS5_V2 = "Standard_DS5_v2" + STANDARD_DS11_V2 = "Standard_DS11_v2" + STANDARD_DS12_V2 = "Standard_DS12_v2" + STANDARD_DS13_V2 = "Standard_DS13_v2" + STANDARD_DS14_V2 = "Standard_DS14_v2" + STANDARD_DS15_V2 = "Standard_DS15_v2" + STANDARD_DS13_4_V2 = "Standard_DS13-4_v2" + STANDARD_DS13_2_V2 = "Standard_DS13-2_v2" + STANDARD_DS14_8_V2 = "Standard_DS14-8_v2" + STANDARD_DS14_4_V2 = "Standard_DS14-4_v2" + STANDARD_E2_V3 = "Standard_E2_v3" + STANDARD_E4_V3 = "Standard_E4_v3" + STANDARD_E8_V3 = "Standard_E8_v3" + STANDARD_E16_V3 = "Standard_E16_v3" + STANDARD_E32_V3 = "Standard_E32_v3" + STANDARD_E64_V3 = "Standard_E64_v3" + STANDARD_E2_S_V3 = "Standard_E2s_v3" + STANDARD_E4_S_V3 = "Standard_E4s_v3" + STANDARD_E8_S_V3 = "Standard_E8s_v3" + STANDARD_E16_S_V3 = "Standard_E16s_v3" + STANDARD_E32_S_V3 = "Standard_E32s_v3" + STANDARD_E64_S_V3 = "Standard_E64s_v3" + STANDARD_E32_16_V3 = "Standard_E32-16_v3" + STANDARD_E32_8_S_V3 = "Standard_E32-8s_v3" + STANDARD_E64_32_S_V3 = "Standard_E64-32s_v3" + STANDARD_E64_16_S_V3 = "Standard_E64-16s_v3" + STANDARD_F1 = "Standard_F1" + STANDARD_F2 = "Standard_F2" + STANDARD_F4 = "Standard_F4" + STANDARD_F8 = "Standard_F8" + STANDARD_F16 = "Standard_F16" + STANDARD_F1_S = "Standard_F1s" + STANDARD_F2_S = "Standard_F2s" + STANDARD_F4_S = "Standard_F4s" + STANDARD_F8_S = "Standard_F8s" + STANDARD_F16_S = "Standard_F16s" + STANDARD_F2_S_V2 = "Standard_F2s_v2" + STANDARD_F4_S_V2 = "Standard_F4s_v2" + STANDARD_F8_S_V2 = "Standard_F8s_v2" + STANDARD_F16_S_V2 = "Standard_F16s_v2" + STANDARD_F32_S_V2 = "Standard_F32s_v2" + STANDARD_F64_S_V2 = "Standard_F64s_v2" + STANDARD_F72_S_V2 = "Standard_F72s_v2" + STANDARD_G1 = "Standard_G1" + STANDARD_G2 = "Standard_G2" + STANDARD_G3 = "Standard_G3" + STANDARD_G4 = "Standard_G4" + STANDARD_G5 = "Standard_G5" + STANDARD_GS1 = "Standard_GS1" + STANDARD_GS2 = "Standard_GS2" + STANDARD_GS3 = "Standard_GS3" + STANDARD_GS4 = "Standard_GS4" + STANDARD_GS5 = "Standard_GS5" + STANDARD_GS4_8 = "Standard_GS4-8" + STANDARD_GS4_4 = "Standard_GS4-4" + STANDARD_GS5_16 = "Standard_GS5-16" + STANDARD_GS5_8 = "Standard_GS5-8" + STANDARD_H8 = "Standard_H8" + STANDARD_H16 = "Standard_H16" + STANDARD_H8_M = "Standard_H8m" + STANDARD_H16_M = "Standard_H16m" + STANDARD_H16_R = "Standard_H16r" + STANDARD_H16_MR = "Standard_H16mr" + STANDARD_L4_S = "Standard_L4s" + STANDARD_L8_S = "Standard_L8s" + STANDARD_L16_S = "Standard_L16s" + STANDARD_L32_S = "Standard_L32s" + STANDARD_M64_S = "Standard_M64s" + STANDARD_M64_MS = "Standard_M64ms" + STANDARD_M128_S = "Standard_M128s" + STANDARD_M128_MS = "Standard_M128ms" + STANDARD_M64_32_MS = "Standard_M64-32ms" + STANDARD_M64_16_MS = "Standard_M64-16ms" + STANDARD_M128_64_MS = "Standard_M128-64ms" + STANDARD_M128_32_MS = "Standard_M128-32ms" + STANDARD_NC6 = "Standard_NC6" + STANDARD_NC12 = "Standard_NC12" + STANDARD_NC24 = "Standard_NC24" + STANDARD_NC24_R = "Standard_NC24r" + STANDARD_NC6_S_V2 = "Standard_NC6s_v2" + STANDARD_NC12_S_V2 = "Standard_NC12s_v2" + STANDARD_NC24_S_V2 = "Standard_NC24s_v2" + STANDARD_NC24_RS_V2 = "Standard_NC24rs_v2" + STANDARD_NC6_S_V3 = "Standard_NC6s_v3" + STANDARD_NC12_S_V3 = "Standard_NC12s_v3" + STANDARD_NC24_S_V3 = "Standard_NC24s_v3" + STANDARD_NC24_RS_V3 = "Standard_NC24rs_v3" + STANDARD_ND6_S = "Standard_ND6s" + STANDARD_ND12_S = "Standard_ND12s" + STANDARD_ND24_S = "Standard_ND24s" + STANDARD_ND24_RS = "Standard_ND24rs" + STANDARD_NV6 = "Standard_NV6" + STANDARD_NV12 = "Standard_NV12" + STANDARD_NV24 = "Standard_NV24" + +class VmDiskTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """VM disk types which are disallowed. + """ + + NONE = "None" + UNMANAGED = "Unmanaged" + +class VMGuestPatchClassificationLinux(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + CRITICAL = "Critical" + SECURITY = "Security" + OTHER = "Other" + +class VMGuestPatchClassificationWindows(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + CRITICAL = "Critical" + SECURITY = "Security" + UPDATE_ROLL_UP = "UpdateRollUp" + FEATURE_PACK = "FeaturePack" + SERVICE_PACK = "ServicePack" + DEFINITION = "Definition" + TOOLS = "Tools" + UPDATES = "Updates" + +class VMGuestPatchRebootBehavior(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Describes the reboot requirements of the patch. + """ + + UNKNOWN = "Unknown" + NEVER_REBOOTS = "NeverReboots" + ALWAYS_REQUIRES_REBOOT = "AlwaysRequiresReboot" + CAN_REQUEST_REBOOT = "CanRequestReboot" + +class VMGuestPatchRebootSetting(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Defines when it is acceptable to reboot a VM during a software update operation. + """ + + IF_REQUIRED = "IfRequired" + NEVER = "Never" + ALWAYS = "Always" + +class VMGuestPatchRebootStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The reboot state of the VM following completion of the operation. + """ + + UNKNOWN = "Unknown" + NOT_NEEDED = "NotNeeded" + REQUIRED = "Required" + STARTED = "Started" + FAILED = "Failed" + COMPLETED = "Completed" + +class 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:`
` + **AutomaticByPlatform** - The platform will trigger periodic patch assessments. The property + provisionVMAgent must be true. + """ + + IMAGE_DEFAULT = "ImageDefault" + AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" + +class WindowsVMGuestPatchAutomaticByPlatformRebootSetting(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the reboot setting for all AutomaticByPlatform patch installation operations. + """ + + UNKNOWN = "Unknown" + IF_REQUIRED = "IfRequired" + NEVER = "Never" + ALWAYS = "Always" + +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 + patches to a virtual machine. You do this by applying patches manually inside the VM. In this + mode, automatic updates are disabled; the property WindowsConfiguration.enableAutomaticUpdates + must be false:code:`
`:code:`
` **AutomaticByOS** - The virtual machine will + automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates + must be true. :code:`
`:code:`
` **AutomaticByPlatform** - the virtual machine will + automatically updated by the platform. The properties provisionVMAgent and + WindowsConfiguration.enableAutomaticUpdates must be true + """ + + MANUAL = "Manual" + AUTOMATIC_BY_OS = "AutomaticByOS" + AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/_models_py3.py new file mode 100644 index 000000000000..ee9dcef7016a --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/models/_models_py3.py @@ -0,0 +1,15511 @@ +# 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 datetime +from typing import Any, Dict, List, Optional, Union + +import msrest.serialization + +from ._compute_management_client_enums import * + + +class AdditionalCapabilities(msrest.serialization.Model): + """Enables or disables a capability on the virtual machine or virtual machine scale set. + + :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. + :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 = { + 'ultra_ssd_enabled': {'key': 'ultraSSDEnabled', 'type': 'bool'}, + 'hibernation_enabled': {'key': 'hibernationEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + ultra_ssd_enabled: Optional[bool] = None, + 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 + + +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. + + :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. + :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. + :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". + :vartype setting_name: str or ~azure.mgmt.compute.v2022_03_01.models.SettingNames + :ivar content: Specifies the XML formatted content that is added to the unattend.xml file for + the specified path and component. The XML must be less than 4KB and must include the root + element for the setting or feature that is being inserted. + :vartype 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, + *, + pass_name: Optional[str] = None, + component_name: Optional[str] = None, + setting_name: Optional[Union[str, "SettingNames"]] = None, + 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.v2022_03_01.models.SettingNames + :keyword content: Specifies the XML formatted content that is added to the unattend.xml file + for the specified path and component. The XML must be less than 4KB and must include the root + element for the setting or feature that is being inserted. + :paramtype content: str + """ + super(AdditionalUnattendContent, self).__init__(**kwargs) + self.pass_name = pass_name + self.component_name = component_name + self.setting_name = setting_name + self.content = content + + +class ApiEntityReference(msrest.serialization.Model): + """The API entity reference. + + :ivar id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + 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 + + +class ApiError(msrest.serialization.Model): + """Api error. + + :ivar details: The Api error details. + :vartype details: list[~azure.mgmt.compute.v2022_03_01.models.ApiErrorBase] + :ivar innererror: The Api inner error. + :vartype innererror: ~azure.mgmt.compute.v2022_03_01.models.InnerError + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str + """ + + _attribute_map = { + 'details': {'key': 'details', 'type': '[ApiErrorBase]'}, + 'innererror': {'key': 'innererror', 'type': 'InnerError'}, + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + details: Optional[List["ApiErrorBase"]] = None, + innererror: Optional["InnerError"] = None, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword details: The Api error details. + :paramtype details: list[~azure.mgmt.compute.v2022_03_01.models.ApiErrorBase] + :keyword innererror: The Api inner error. + :paramtype innererror: ~azure.mgmt.compute.v2022_03_01.models.InnerError + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ + super(ApiError, self).__init__(**kwargs) + self.details = details + self.innererror = innererror + self.code = code + self.target = target + self.message = message + + +class ApiErrorBase(msrest.serialization.Model): + """Api error base. + + :ivar code: The error code. + :vartype code: str + :ivar target: The target of the particular error. + :vartype target: str + :ivar message: The error message. + :vartype message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + target: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword target: The target of the particular error. + :paramtype target: str + :keyword message: The error message. + :paramtype message: str + """ + super(ApiErrorBase, self).__init__(**kwargs) + self.code = code + self.target = target + self.message = message + + +class ApplicationProfile(msrest.serialization.Model): + """Contains the list of gallery applications that should be made available to the VM/VMSS. + + :ivar gallery_applications: Specifies the gallery applications that should be made available to + the VM/VMSS. + :vartype gallery_applications: + list[~azure.mgmt.compute.v2022_03_01.models.VMGalleryApplication] + """ + + _attribute_map = { + 'gallery_applications': {'key': 'galleryApplications', 'type': '[VMGalleryApplication]'}, + } + + def __init__( + self, + *, + 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.v2022_03_01.models.VMGalleryApplication] + """ + super(ApplicationProfile, self).__init__(**kwargs) + self.gallery_applications = gallery_applications + + +class AutomaticOSUpgradePolicy(msrest.serialization.Model): + """The configuration parameters used for performing automatic OS upgrade. + + :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. + :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 + :ivar use_rolling_upgrade_policy: Indicates whether rolling upgrade policy should be used + during Auto OS Upgrade. Default value is false. Auto OS Upgrade will fallback to the default + policy if no policy is defined on the VMSS. + :vartype use_rolling_upgrade_policy: bool + """ + + _attribute_map = { + 'enable_automatic_os_upgrade': {'key': 'enableAutomaticOSUpgrade', 'type': 'bool'}, + 'disable_automatic_rollback': {'key': 'disableAutomaticRollback', 'type': 'bool'}, + 'use_rolling_upgrade_policy': {'key': 'useRollingUpgradePolicy', 'type': 'bool'}, + } + + def __init__( + self, + *, + enable_automatic_os_upgrade: Optional[bool] = None, + disable_automatic_rollback: Optional[bool] = None, + use_rolling_upgrade_policy: 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 + :keyword use_rolling_upgrade_policy: Indicates whether rolling upgrade policy should be used + during Auto OS Upgrade. Default value is false. Auto OS Upgrade will fallback to the default + policy if no policy is defined on the VMSS. + :paramtype use_rolling_upgrade_policy: bool + """ + super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) + self.enable_automatic_os_upgrade = enable_automatic_os_upgrade + self.disable_automatic_rollback = disable_automatic_rollback + self.use_rolling_upgrade_policy = use_rolling_upgrade_policy + + +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. + + :ivar automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :vartype automatic_os_upgrade_supported: bool + """ + + _validation = { + 'automatic_os_upgrade_supported': {'required': True}, + } + + _attribute_map = { + 'automatic_os_upgrade_supported': {'key': 'automaticOSUpgradeSupported', 'type': 'bool'}, + } + + def __init__( + self, + *, + automatic_os_upgrade_supported: bool, + **kwargs + ): + """ + :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 + + +class AutomaticRepairsPolicy(msrest.serialization.Model): + """Specifies the configuration parameters for automatic repairs on the virtual machine scale set. + + :ivar enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :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 10 minutes (PT10M), which is also the default value. The + maximum allowed grace period is 90 minutes (PT90M). + :vartype grace_period: str + :ivar repair_action: Type of repair action (replace, restart, reimage) that will be used for + repairing unhealthy virtual machines in the scale set. Default value is replace. Possible + values include: "Replace", "Restart", "Reimage". + :vartype repair_action: str or ~azure.mgmt.compute.v2022_03_01.models.RepairAction + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'grace_period': {'key': 'gracePeriod', 'type': 'str'}, + 'repair_action': {'key': 'repairAction', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + grace_period: Optional[str] = None, + repair_action: Optional[Union[str, "RepairAction"]] = 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 10 minutes (PT10M), which is also the default + value. The maximum allowed grace period is 90 minutes (PT90M). + :paramtype grace_period: str + :keyword repair_action: Type of repair action (replace, restart, reimage) that will be used for + repairing unhealthy virtual machines in the scale set. Default value is replace. Possible + values include: "Replace", "Restart", "Reimage". + :paramtype repair_action: str or ~azure.mgmt.compute.v2022_03_01.models.RepairAction + """ + super(AutomaticRepairsPolicy, self).__init__(**kwargs) + self.enabled = enabled + self.grace_period = grace_period + self.repair_action = repair_action + + +class Resource(msrest.serialization.Model): + """The Resource model definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class 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 + :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'. + :vartype sku: ~azure.mgmt.compute.v2022_03_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :ivar proximity_placement_group: Specifies information about the proximity placement group that + the availability set should be assigned to. :code:`
`:code:`
`Minimum api-version: + 2018-04-01. + :vartype proximity_placement_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'statuses': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'platform_update_domain_count': {'key': 'properties.platformUpdateDomainCount', 'type': 'int'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResource]'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + platform_update_domain_count: Optional[int] = None, + platform_fault_domain_count: Optional[int] = None, + virtual_machines: Optional[List["SubResource"]] = None, + proximity_placement_group: Optional["SubResource"] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :keyword proximity_placement_group: Specifies information about the proximity placement group + that the availability set should be assigned to. :code:`
`:code:`
`Minimum api-version: + 2018-04-01. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + """ + super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.platform_update_domain_count = platform_update_domain_count + self.platform_fault_domain_count = platform_fault_domain_count + self.virtual_machines = virtual_machines + self.proximity_placement_group = proximity_placement_group + self.statuses = None + + +class AvailabilitySetListResult(msrest.serialization.Model): + """The List Availability Set operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of availability sets. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.AvailabilitySet] + :ivar next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + URI to fetch the next page of AvailabilitySets. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AvailabilitySet"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of availability sets. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.AvailabilitySet] + :keyword next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with + this URI to fetch the next page of AvailabilitySets. + :paramtype next_link: str + """ + super(AvailabilitySetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class UpdateResource(msrest.serialization.Model): + """The Update Resource model definition. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(UpdateResource, self).__init__(**kwargs) + self.tags = tags + + +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. + + :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.v2022_03_01.models.Sku + :ivar platform_update_domain_count: Update Domain count. + :vartype platform_update_domain_count: int + :ivar platform_fault_domain_count: Fault Domain count. + :vartype platform_fault_domain_count: int + :ivar virtual_machines: A list of references to all virtual machines in the availability set. + :vartype virtual_machines: list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :ivar proximity_placement_group: Specifies information about the proximity placement group that + the availability set should be assigned to. :code:`
`:code:`
`Minimum api-version: + 2018-04-01. + :vartype proximity_placement_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + + _validation = { + 'statuses': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'platform_update_domain_count': {'key': 'properties.platformUpdateDomainCount', 'type': 'int'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResource]'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + platform_update_domain_count: Optional[int] = None, + platform_fault_domain_count: Optional[int] = None, + virtual_machines: Optional[List["SubResource"]] = None, + proximity_placement_group: Optional["SubResource"] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.Sku + :keyword platform_update_domain_count: Update Domain count. + :paramtype platform_update_domain_count: int + :keyword platform_fault_domain_count: Fault Domain count. + :paramtype platform_fault_domain_count: int + :keyword virtual_machines: A list of references to all virtual machines in the availability + set. + :paramtype virtual_machines: list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :keyword proximity_placement_group: Specifies information about the proximity placement group + that the availability set should be assigned to. :code:`
`:code:`
`Minimum api-version: + 2018-04-01. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + """ + super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) + self.sku = sku + self.platform_update_domain_count = platform_update_domain_count + self.platform_fault_domain_count = platform_fault_domain_count + self.virtual_machines = virtual_machines + self.proximity_placement_group = proximity_placement_group + self.statuses = None + + +class AvailablePatchSummary(msrest.serialization.Model): + """Describes the properties of an virtual machine instance view for available patch summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2022_03_01.models.PatchOperationStatus + :ivar assessment_activity_id: The activity ID of the operation that produced this result. It is + used to correlate across CRP and extension logs. + :vartype assessment_activity_id: str + :ivar reboot_pending: The overall reboot status of the VM. It will be true when partially + installed patches require a reboot to complete installation but the reboot has not yet + occurred. + :vartype reboot_pending: bool + :ivar critical_and_security_patch_count: The number of critical or security patches that have + been detected as available and not yet installed. + :vartype critical_and_security_patch_count: int + :ivar other_patch_count: The number of all available patches excluding critical and security. + :vartype other_patch_count: int + :ivar start_time: The UTC timestamp when the operation began. + :vartype start_time: ~datetime.datetime + :ivar last_modified_time: The UTC timestamp when the operation began. + :vartype last_modified_time: ~datetime.datetime + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2022_03_01.models.ApiError + """ + + _validation = { + 'status': {'readonly': True}, + 'assessment_activity_id': {'readonly': True}, + 'reboot_pending': {'readonly': True}, + 'critical_and_security_patch_count': {'readonly': True}, + 'other_patch_count': {'readonly': True}, + 'start_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'assessment_activity_id': {'key': 'assessmentActivityId', 'type': 'str'}, + 'reboot_pending': {'key': 'rebootPending', 'type': 'bool'}, + 'critical_and_security_patch_count': {'key': 'criticalAndSecurityPatchCount', 'type': 'int'}, + 'other_patch_count': {'key': 'otherPatchCount', 'type': 'int'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AvailablePatchSummary, self).__init__(**kwargs) + self.status = None + self.assessment_activity_id = None + self.reboot_pending = None + self.critical_and_security_patch_count = None + self.other_patch_count = None + self.start_time = None + self.last_modified_time = None + self.error = None + + +class BillingProfile(msrest.serialization.Model): + """Specifies the billing related details of a Azure Spot VM or VMSS. :code:`
`:code:`
`Minimum api-version: 2019-03-01. + + :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 + 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. + :vartype max_price: float + """ + + _attribute_map = { + 'max_price': {'key': 'maxPrice', 'type': 'float'}, + } + + def __init__( + self, + *, + 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 + + +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. + + :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. + :vartype storage_uri: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + storage_uri: Optional[str] = None, + **kwargs + ): + """ + :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 + + +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.v2022_03_01.models.InstanceViewStatus + """ + + _validation = { + 'console_screenshot_blob_uri': {'readonly': True}, + 'serial_console_log_blob_uri': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'console_screenshot_blob_uri': {'key': 'consoleScreenshotBlobUri', 'type': 'str'}, + 'serial_console_log_blob_uri': {'key': 'serialConsoleLogBlobUri', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(BootDiagnosticsInstanceView, self).__init__(**kwargs) + self.console_screenshot_blob_uri = None + self.serial_console_log_blob_uri = None + self.status = None + + +class 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 + :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. + :vartype sku: ~azure.mgmt.compute.v2022_03_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. + :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 + :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.v2022_03_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.v2022_03_01.models.CapacityReservationInstanceView + :ivar time_created: Specifies the time at which the Capacity Reservation resource was + created.:code:`
`:code:`
`Minimum api-version: 2022-03-01. + :vartype time_created: ~datetime.datetime + """ + + _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}, + 'time_created': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + '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'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + sku: "Sku", + tags: Optional[Dict[str, str]] = None, + 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.v2022_03_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 + self.reservation_id = None + self.virtual_machines_associated = None + self.provisioning_time = None + self.provisioning_state = None + self.instance_view = None + self.time_created = 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 + :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. + :vartype 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.v2022_03_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.v2022_03_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.v2022_03_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, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + 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 + 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.v2022_03_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. + + :ivar value: Required. The list of capacity reservation groups. + :vartype value: list[~azure.mgmt.compute.v2022_03_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 = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CapacityReservationGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CapacityReservationGroup"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of capacity reservation groups. + :paramtype value: list[~azure.mgmt.compute.v2022_03_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 + + +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. + + :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: + list[~azure.mgmt.compute.v2022_03_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.v2022_03_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.v2022_03_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, + *, + 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 + 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. + + :ivar utilization_info: Unutilized capacity of the capacity reservation. + :vartype utilization_info: + ~azure.mgmt.compute.v2022_03_01.models.CapacityReservationUtilization + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'utilization_info': {'key': 'utilizationInfo', 'type': 'CapacityReservationUtilization'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + utilization_info: Optional["CapacityReservationUtilization"] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + """ + :keyword utilization_info: Unutilized capacity of the capacity reservation. + :paramtype utilization_info: + ~azure.mgmt.compute.v2022_03_01.models.CapacityReservationUtilization + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + super(CapacityReservationInstanceView, self).__init__(**kwargs) + self.utilization_info = utilization_info + self.statuses = statuses + + +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. + + :ivar utilization_info: Unutilized capacity of the capacity reservation. + :vartype utilization_info: + ~azure.mgmt.compute.v2022_03_01.models.CapacityReservationUtilization + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_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, + *, + utilization_info: Optional["CapacityReservationUtilization"] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + """ + :keyword utilization_info: Unutilized capacity of the capacity reservation. + :paramtype utilization_info: + ~azure.mgmt.compute.v2022_03_01.models.CapacityReservationUtilization + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + super(CapacityReservationInstanceViewWithName, self).__init__(utilization_info=utilization_info, statuses=statuses, **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. + + :ivar value: Required. The list of capacity reservations. + :vartype value: list[~azure.mgmt.compute.v2022_03_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. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CapacityReservation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CapacityReservation"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of capacity reservations. + :paramtype value: list[~azure.mgmt.compute.v2022_03_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 + + +class CapacityReservationProfile(msrest.serialization.Model): + """The parameters of a capacity reservation Profile. + + :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. + :vartype capacity_reservation_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + """ + + _attribute_map = { + 'capacity_reservation_group': {'key': 'capacityReservationGroup', 'type': 'SubResource'}, + } + + def __init__( + self, + *, + 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.v2022_03_01.models.SubResource + """ + super(CapacityReservationProfile, self).__init__(**kwargs) + self.capacity_reservation_group = capacity_reservation_group + + +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. + + :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. + :vartype sku: ~azure.mgmt.compute.v2022_03_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.v2022_03_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.v2022_03_01.models.CapacityReservationInstanceView + :ivar time_created: Specifies the time at which the Capacity Reservation resource was + created.:code:`
`:code:`
`Minimum api-version: 2022-03-01. + :vartype time_created: ~datetime.datetime + """ + + _validation = { + 'reservation_id': {'readonly': True}, + 'virtual_machines_associated': {'readonly': True}, + 'provisioning_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + 'time_created': {'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'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + 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.v2022_03_01.models.Sku + """ + super(CapacityReservationUpdate, self).__init__(tags=tags, **kwargs) + self.sku = sku + self.reservation_id = None + self.virtual_machines_associated = None + self.provisioning_time = None + self.provisioning_state = None + self.instance_view = None + self.time_created = 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.v2022_03_01.models.SubResourceReadOnly] + """ + + _validation = { + 'virtual_machines_allocated': {'readonly': True}, + } + + _attribute_map = { + 'virtual_machines_allocated': {'key': 'virtualMachinesAllocated', 'type': '[SubResourceReadOnly]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CapacityReservationUtilization, self).__init__(**kwargs) + self.virtual_machines_allocated = None + + +class ComputeOperationListResult(msrest.serialization.Model): + """The List Compute Operation operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of compute operations. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.ComputeOperationValue] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ComputeOperationValue]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ComputeOperationListResult, self).__init__(**kwargs) + self.value = None + + +class ComputeOperationValue(msrest.serialization.Model): + """Describes the properties of a Compute Operation value. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar origin: The origin of the compute operation. + :vartype origin: str + :ivar name: The name of the compute operation. + :vartype name: str + :ivar operation: The display name of the compute operation. + :vartype operation: str + :ivar resource: The display name of the resource the operation applies to. + :vartype resource: str + :ivar description: The description of the operation. + :vartype description: str + :ivar provider: The resource provider for the operation. + :vartype provider: str + """ + + _validation = { + 'origin': {'readonly': True}, + 'name': {'readonly': True}, + 'operation': {'readonly': True}, + 'resource': {'readonly': True}, + 'description': {'readonly': True}, + 'provider': {'readonly': True}, + } + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'operation': {'key': 'display.operation', 'type': 'str'}, + 'resource': {'key': 'display.resource', 'type': 'str'}, + 'description': {'key': 'display.description', 'type': 'str'}, + 'provider': {'key': 'display.provider', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ComputeOperationValue, self).__init__(**kwargs) + self.origin = None + self.name = None + self.operation = None + self.resource = None + self.description = None + self.provider = None + + +class DataDisk(msrest.serialization.Model): + """Describes a data disk. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :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. + :vartype lun: int + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2022_03_01.models.VirtualHardDisk + :ivar image: The source user image virtual hard disk. The virtual hard disk will be copied + before being attached to the virtual machine. If SourceImage is provided, the destination + virtual hard drive must not exist. + :vartype image: ~azure.mgmt.compute.v2022_03_01.models.VirtualHardDisk + :ivar caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :ivar write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :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". + :vartype create_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskCreateOptionTypes + :ivar disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + used to overwrite the size of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.ManagedDiskParameters + :ivar to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :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. + :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 + :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 + 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". + :vartype detach_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskDetachOptionTypes + :ivar delete_option: Specifies whether data disk should be deleted or detached upon VM + deletion.:code:`
`:code:`
` Possible values: :code:`
`:code:`
` **Delete** If this + value is used, the data disk is deleted when VM is deleted.:code:`
`:code:`
` **Detach** + If this value is used, the data disk is retained after VM is deleted.:code:`
`:code:`
` + The default value is set to **detach**. Possible values include: "Delete", "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskDeleteOptionTypes + """ + + _validation = { + 'lun': {'required': True}, + 'create_option': {'required': True}, + 'disk_iops_read_write': {'readonly': True}, + 'disk_m_bps_read_write': {'readonly': True}, + } + + _attribute_map = { + 'lun': {'key': 'lun', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, + 'to_be_detached': {'key': 'toBeDetached', 'type': 'bool'}, + 'disk_iops_read_write': {'key': 'diskIOPSReadWrite', 'type': 'long'}, + 'disk_m_bps_read_write': {'key': 'diskMBpsReadWrite', 'type': 'long'}, + 'detach_option': {'key': 'detachOption', 'type': 'str'}, + 'delete_option': {'key': 'deleteOption', 'type': 'str'}, + } + + def __init__( + self, + *, + lun: int, + create_option: Union[str, "DiskCreateOptionTypes"], + name: Optional[str] = None, + vhd: Optional["VirtualHardDisk"] = None, + image: Optional["VirtualHardDisk"] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + disk_size_gb: Optional[int] = None, + managed_disk: Optional["ManagedDiskParameters"] = None, + to_be_detached: Optional[bool] = None, + detach_option: Optional[Union[str, "DiskDetachOptionTypes"]] = None, + 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.v2022_03_01.models.VirtualHardDisk + :keyword image: The source user image virtual hard disk. The virtual hard disk will be copied + before being attached to the virtual machine. If SourceImage is provided, the destination + virtual hard drive must not exist. + :paramtype image: ~azure.mgmt.compute.v2022_03_01.models.VirtualHardDisk + :keyword caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. Specifies how the virtual machine should be + created.:code:`
`:code:`
` Possible values are::code:`
`:code:`
` **Attach** \u2013 + This value is used when you are using a specialized disk to create the virtual + machine.:code:`
`:code:`
` **FromImage** \u2013 This value is used when you are using an + image to create the virtual machine. If you are using a platform image, you also use the + imageReference element described above. If you are using a marketplace image, you also use the + plan element previously described. Possible values include: "FromImage", "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskCreateOptionTypes + :keyword disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can + be used to overwrite the size of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.ManagedDiskParameters + :keyword to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :paramtype to_be_detached: bool + :keyword detach_option: Specifies the detach behavior to be used while detaching a disk or + which is already in the process of detachment from the virtual machine. Supported values: + **ForceDetach**. :code:`
`:code:`
` detachOption: **ForceDetach** is applicable only for + managed data disks. If a previous detachment attempt of the data disk did not complete due to + an unexpected failure from the virtual machine and the disk is still not released then use + force-detach as a last resort option to detach the disk forcibly from the VM. All writes might + not have been flushed when using this detach behavior. :code:`
`:code:`
` This feature is + still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data + disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. Possible + values include: "ForceDetach". + :paramtype detach_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskDetachOptionTypes + :keyword delete_option: Specifies whether data disk should be deleted or detached upon VM + deletion.:code:`
`:code:`
` Possible values: :code:`
`:code:`
` **Delete** If this + value is used, the data disk is deleted when VM is deleted.:code:`
`:code:`
` **Detach** + If this value is used, the data disk is retained after VM is deleted.:code:`
`:code:`
` + The default value is set to **detach**. Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskDeleteOptionTypes + """ + super(DataDisk, self).__init__(**kwargs) + self.lun = lun + self.name = name + self.vhd = vhd + self.image = image + self.caching = caching + self.write_accelerator_enabled = write_accelerator_enabled + self.create_option = create_option + self.disk_size_gb = disk_size_gb + self.managed_disk = managed_disk + self.to_be_detached = to_be_detached + self.disk_iops_read_write = None + self.disk_m_bps_read_write = None + self.detach_option = detach_option + self.delete_option = delete_option + + +class DataDiskImage(msrest.serialization.Model): + """Contains the data disk images information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar lun: Specifies the logical unit number of the data disk. This value is used to identify + data disks within the VM and therefore must be unique for each data disk attached to a VM. + :vartype lun: int + """ + + _validation = { + 'lun': {'readonly': True}, + } + + _attribute_map = { + 'lun': {'key': 'lun', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DataDiskImage, self).__init__(**kwargs) + self.lun = None + + +class DedicatedHost(Resource): + """Specifies information about the Dedicated host. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :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.v2022_03_01.models.Sku + :ivar platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :vartype platform_fault_domain: int + :ivar auto_replace_on_failure: Specifies whether the dedicated host should be replaced + automatically in case of a failure. The value is defaulted to 'true' when not provided. + :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.v2022_03_01.models.SubResourceReadOnly] + :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". + :vartype license_type: str or ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostLicenseTypes + :ivar provisioning_time: The date when the host was first provisioned. + :vartype provisioning_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The dedicated host instance view. + :vartype instance_view: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostInstanceView + :ivar time_created: Specifies the time at which the Dedicated Host resource was + created.:code:`
`:code:`
`Minimum api-version: 2022-03-01. + :vartype time_created: ~datetime.datetime + """ + + _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}, + 'time_created': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + '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'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + sku: "Sku", + tags: Optional[Dict[str, str]] = None, + platform_fault_domain: Optional[int] = None, + auto_replace_on_failure: Optional[bool] = None, + license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.Sku + :keyword platform_fault_domain: Fault domain of the dedicated host within a dedicated host + group. + :paramtype platform_fault_domain: int + :keyword auto_replace_on_failure: Specifies whether the dedicated host should be replaced + automatically in case of a failure. The value is defaulted to 'true' when not provided. + :paramtype auto_replace_on_failure: bool + :keyword license_type: Specifies the software license type that will be applied to the VMs + deployed on the dedicated host. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **None** :code:`
`:code:`
` **Windows_Server_Hybrid** + :code:`
`:code:`
` **Windows_Server_Perpetual** :code:`
`:code:`
` Default: + **None**. Possible values include: "None", "Windows_Server_Hybrid", "Windows_Server_Perpetual". + :paramtype license_type: str or + ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostLicenseTypes + """ + super(DedicatedHost, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.platform_fault_domain = platform_fault_domain + self.auto_replace_on_failure = auto_replace_on_failure + self.host_id = None + self.virtual_machines = None + self.license_type = license_type + self.provisioning_time = None + self.provisioning_state = None + self.instance_view = None + self.time_created = None + + +class DedicatedHostAllocatableVM(msrest.serialization.Model): + """Represents the dedicated host unutilized capacity in terms of a specific VM size. + + :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. + :vartype count: float + """ + + _attribute_map = { + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'float'}, + } + + def __init__( + self, + *, + vm_size: Optional[str] = None, + count: Optional[float] = None, + **kwargs + ): + """ + :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 + + +class DedicatedHostAvailableCapacity(msrest.serialization.Model): + """Dedicated host unutilized capacity. + + :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. + :vartype allocatable_v_ms: + list[~azure.mgmt.compute.v2022_03_01.models.DedicatedHostAllocatableVM] + """ + + _attribute_map = { + 'allocatable_v_ms': {'key': 'allocatableVMs', 'type': '[DedicatedHostAllocatableVM]'}, + } + + def __init__( + self, + *, + 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.v2022_03_01.models.DedicatedHostAllocatableVM] + """ + super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) + self.allocatable_v_ms = allocatable_v_ms + + +class DedicatedHostGroup(Resource): + """Specifies information about the dedicated host group that the dedicated hosts should be assigned to. :code:`
`:code:`
` Currently, a dedicated host can only be added to a dedicated host group at creation time. An existing dedicated host cannot be added to another dedicated host group. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :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. + :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.v2022_03_01.models.SubResourceReadOnly] + :ivar instance_view: The dedicated host group instance view, which has the list of instance + view of the dedicated hosts under the dedicated host group. + :vartype instance_view: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroupInstanceView + :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. + :vartype support_automatic_placement: bool + :ivar additional_capabilities: Enables or disables a capability on the dedicated host + group.:code:`
`:code:`
`Minimum api-version: 2022-03-01. + :vartype additional_capabilities: + ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroupPropertiesAdditionalCapabilities + """ + + _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'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'DedicatedHostGroupPropertiesAdditionalCapabilities'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, + platform_fault_domain_count: Optional[int] = None, + support_automatic_placement: Optional[bool] = None, + additional_capabilities: Optional["DedicatedHostGroupPropertiesAdditionalCapabilities"] = 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 + :keyword additional_capabilities: Enables or disables a capability on the dedicated host + group.:code:`
`:code:`
`Minimum api-version: 2022-03-01. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroupPropertiesAdditionalCapabilities + """ + super(DedicatedHostGroup, self).__init__(location=location, tags=tags, **kwargs) + self.zones = zones + self.platform_fault_domain_count = platform_fault_domain_count + self.hosts = None + self.instance_view = None + self.support_automatic_placement = support_automatic_placement + self.additional_capabilities = additional_capabilities + + +class DedicatedHostGroupInstanceView(msrest.serialization.Model): + """DedicatedHostGroupInstanceView. + + :ivar hosts: List of instance view of the dedicated hosts under the dedicated host group. + :vartype hosts: list[~azure.mgmt.compute.v2022_03_01.models.DedicatedHostInstanceViewWithName] + """ + + _attribute_map = { + 'hosts': {'key': 'hosts', 'type': '[DedicatedHostInstanceViewWithName]'}, + } + + def __init__( + self, + *, + 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.v2022_03_01.models.DedicatedHostInstanceViewWithName] + """ + super(DedicatedHostGroupInstanceView, self).__init__(**kwargs) + self.hosts = hosts + + +class DedicatedHostGroupListResult(msrest.serialization.Model): + """The List Dedicated Host Group with resource group response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of dedicated host groups. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroup] + :ivar next_link: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with + this URI to fetch the next page of Dedicated Host Groups. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DedicatedHostGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DedicatedHostGroup"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of dedicated host groups. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroup] + :keyword next_link: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() + with this URI to fetch the next page of Dedicated Host Groups. + :paramtype next_link: str + """ + super(DedicatedHostGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DedicatedHostGroupPropertiesAdditionalCapabilities(msrest.serialization.Model): + """Enables or disables a capability on the dedicated host group.:code:`
`:code:`
`Minimum api-version: 2022-03-01. + + :ivar ultra_ssd_enabled: The flag that enables or disables a capability to have UltraSSD + Enabled Virtual Machines on Dedicated Hosts of the Dedicated Host Group. For the Virtual + Machines to be UltraSSD Enabled, UltraSSDEnabled flag for the resource needs to be set true as + well. The value is defaulted to 'false' when not provided. Please refer to + https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-ultra-ssd for more details + on Ultra SSD feature. :code:`
`:code:`
`NOTE: The ultraSSDEnabled setting can only be + enabled for Host Groups that are created as zonal. :code:`
`:code:`
`Minimum api-version: + 2022-03-01. + :vartype ultra_ssd_enabled: bool + """ + + _attribute_map = { + 'ultra_ssd_enabled': {'key': 'ultraSSDEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + ultra_ssd_enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword ultra_ssd_enabled: The flag that enables or disables a capability to have UltraSSD + Enabled Virtual Machines on Dedicated Hosts of the Dedicated Host Group. For the Virtual + Machines to be UltraSSD Enabled, UltraSSDEnabled flag for the resource needs to be set true as + well. The value is defaulted to 'false' when not provided. Please refer to + https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-ultra-ssd for more details + on Ultra SSD feature. :code:`
`:code:`
`NOTE: The ultraSSDEnabled setting can only be + enabled for Host Groups that are created as zonal. :code:`
`:code:`
`Minimum api-version: + 2022-03-01. + :paramtype ultra_ssd_enabled: bool + """ + super(DedicatedHostGroupPropertiesAdditionalCapabilities, self).__init__(**kwargs) + self.ultra_ssd_enabled = ultra_ssd_enabled + + +class DedicatedHostGroupUpdate(UpdateResource): + """Specifies information about the dedicated host group that the dedicated host should be assigned to. Only tags may be updated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar 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. + :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.v2022_03_01.models.SubResourceReadOnly] + :ivar instance_view: The dedicated host group instance view, which has the list of instance + view of the dedicated hosts under the dedicated host group. + :vartype instance_view: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroupInstanceView + :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. + :vartype support_automatic_placement: bool + :ivar additional_capabilities: Enables or disables a capability on the dedicated host + group.:code:`
`:code:`
`Minimum api-version: 2022-03-01. + :vartype additional_capabilities: + ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroupPropertiesAdditionalCapabilities + """ + + _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'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'DedicatedHostGroupPropertiesAdditionalCapabilities'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, + platform_fault_domain_count: Optional[int] = None, + support_automatic_placement: Optional[bool] = None, + additional_capabilities: Optional["DedicatedHostGroupPropertiesAdditionalCapabilities"] = 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 + :keyword additional_capabilities: Enables or disables a capability on the dedicated host + group.:code:`
`:code:`
`Minimum api-version: 2022-03-01. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroupPropertiesAdditionalCapabilities + """ + super(DedicatedHostGroupUpdate, self).__init__(tags=tags, **kwargs) + self.zones = zones + self.platform_fault_domain_count = platform_fault_domain_count + self.hosts = None + self.instance_view = None + self.support_automatic_placement = support_automatic_placement + self.additional_capabilities = additional_capabilities + + +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 + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + + _validation = { + 'asset_id': {'readonly': True}, + } + + _attribute_map = { + 'asset_id': {'key': 'assetId', 'type': 'str'}, + 'available_capacity': {'key': 'availableCapacity', 'type': 'DedicatedHostAvailableCapacity'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + available_capacity: Optional["DedicatedHostAvailableCapacity"] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + super(DedicatedHostInstanceView, self).__init__(**kwargs) + self.asset_id = None + self.available_capacity = available_capacity + self.statuses = statuses + + +class DedicatedHostInstanceViewWithName(DedicatedHostInstanceView): + """The instance view of a dedicated host that includes the name of the dedicated host. It is used for the response to the instance view of a dedicated host group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar asset_id: Specifies the unique id of the dedicated physical machine on which the + dedicated host resides. + :vartype asset_id: str + :ivar available_capacity: Unutilized capacity of the dedicated host. + :vartype available_capacity: + ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostAvailableCapacity + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + :ivar name: The name of the dedicated host. + :vartype name: str + """ + + _validation = { + 'asset_id': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'asset_id': {'key': 'assetId', 'type': 'str'}, + 'available_capacity': {'key': 'availableCapacity', 'type': 'DedicatedHostAvailableCapacity'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + available_capacity: Optional["DedicatedHostAvailableCapacity"] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + """ + :keyword available_capacity: Unutilized capacity of the dedicated host. + :paramtype available_capacity: + ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostAvailableCapacity + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + super(DedicatedHostInstanceViewWithName, self).__init__(available_capacity=available_capacity, statuses=statuses, **kwargs) + self.name = None + + +class DedicatedHostListResult(msrest.serialization.Model): + """The list dedicated host operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of dedicated hosts. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.DedicatedHost] + :ivar next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with this + URI to fetch the next page of dedicated hosts. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DedicatedHost]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DedicatedHost"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of dedicated hosts. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.DedicatedHost] + :keyword next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with + this URI to fetch the next page of dedicated hosts. + :paramtype next_link: str + """ + super(DedicatedHostListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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. + + :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. + :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.v2022_03_01.models.SubResourceReadOnly] + :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". + :vartype license_type: str or ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostLicenseTypes + :ivar provisioning_time: The date when the host was first provisioned. + :vartype provisioning_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The dedicated host instance view. + :vartype instance_view: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostInstanceView + :ivar time_created: Specifies the time at which the Dedicated Host resource was + created.:code:`
`:code:`
`Minimum api-version: 2022-03-01. + :vartype time_created: ~datetime.datetime + """ + + _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}, + 'time_created': {'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'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + platform_fault_domain: Optional[int] = None, + auto_replace_on_failure: Optional[bool] = None, + license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.DedicatedHostLicenseTypes + """ + super(DedicatedHostUpdate, self).__init__(tags=tags, **kwargs) + self.platform_fault_domain = platform_fault_domain + self.auto_replace_on_failure = auto_replace_on_failure + self.host_id = None + self.virtual_machines = None + self.license_type = license_type + self.provisioning_time = None + self.provisioning_state = None + self.instance_view = None + self.time_created = None + + +class DiagnosticsProfile(msrest.serialization.Model): + """Specifies the boot diagnostic settings state. :code:`
`:code:`
`Minimum api-version: 2015-06-15. + + :ivar boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. :code:`
`\ **NOTE**\ : If storageUri is + being specified then ensure that the storage account is in the same region and subscription as + the VM. :code:`
`:code:`
` You can easily view the output of your console log. + :code:`
`:code:`
` Azure also enables you to see a screenshot of the VM from the + hypervisor. + :vartype boot_diagnostics: ~azure.mgmt.compute.v2022_03_01.models.BootDiagnostics + """ + + _attribute_map = { + 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnostics'}, + } + + def __init__( + self, + *, + 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.v2022_03_01.models.BootDiagnostics + """ + super(DiagnosticsProfile, self).__init__(**kwargs) + self.boot_diagnostics = boot_diagnostics + + +class DiffDiskSettings(msrest.serialization.Model): + """Describes the parameters of ephemeral disk settings that can be specified for operating system disk. :code:`
`:code:`
` NOTE: The ephemeral disk settings can only be specified for managed disk. + + :ivar option: Specifies the ephemeral disk settings for operating system disk. Possible values + include: "Local". + :vartype option: str or ~azure.mgmt.compute.v2022_03_01.models.DiffDiskOptions + :ivar placement: Specifies the ephemeral disk placement for operating system + disk.:code:`
`:code:`
` Possible values are: :code:`
`:code:`
` **CacheDisk** + :code:`
`:code:`
` **ResourceDisk** :code:`
`:code:`
` Default: **CacheDisk** if + one is configured for the VM size otherwise **ResourceDisk** is used.:code:`
`:code:`
` + 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". + :vartype placement: str or ~azure.mgmt.compute.v2022_03_01.models.DiffDiskPlacement + """ + + _attribute_map = { + 'option': {'key': 'option', 'type': 'str'}, + 'placement': {'key': 'placement', 'type': 'str'}, + } + + def __init__( + self, + *, + option: Optional[Union[str, "DiffDiskOptions"]] = None, + placement: Optional[Union[str, "DiffDiskPlacement"]] = None, + **kwargs + ): + """ + :keyword option: Specifies the ephemeral disk settings for operating system disk. Possible + values include: "Local". + :paramtype option: str or ~azure.mgmt.compute.v2022_03_01.models.DiffDiskOptions + :keyword placement: Specifies the ephemeral disk placement for operating system + disk.:code:`
`:code:`
` Possible values are: :code:`
`:code:`
` **CacheDisk** + :code:`
`:code:`
` **ResourceDisk** :code:`
`:code:`
` Default: **CacheDisk** if + one is configured for the VM size otherwise **ResourceDisk** is used.:code:`
`:code:`
` + Refer to VM size documentation for Windows VM at + https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at + https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM sizes exposes a + cache disk. Possible values include: "CacheDisk", "ResourceDisk". + :paramtype placement: str or ~azure.mgmt.compute.v2022_03_01.models.DiffDiskPlacement + """ + super(DiffDiskSettings, self).__init__(**kwargs) + self.option = option + self.placement = placement + + +class DisallowedConfiguration(msrest.serialization.Model): + """Specifies the disallowed configuration for a virtual machine image. + + :ivar vm_disk_type: VM disk types which are disallowed. Possible values include: "None", + "Unmanaged". + :vartype vm_disk_type: str or ~azure.mgmt.compute.v2022_03_01.models.VmDiskTypes + """ + + _attribute_map = { + 'vm_disk_type': {'key': 'vmDiskType', 'type': 'str'}, + } + + def __init__( + self, + *, + vm_disk_type: Optional[Union[str, "VmDiskTypes"]] = None, + **kwargs + ): + """ + :keyword vm_disk_type: VM disk types which are disallowed. Possible values include: "None", + "Unmanaged". + :paramtype vm_disk_type: str or ~azure.mgmt.compute.v2022_03_01.models.VmDiskTypes + """ + super(DisallowedConfiguration, self).__init__(**kwargs) + self.vm_disk_type = vm_disk_type + + +class SubResource(msrest.serialization.Model): + """SubResource. + + :ivar id: Resource Id. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ + super(SubResource, self).__init__(**kwargs) + self.id = id + + +class DiskEncryptionSetParameters(SubResource): + """Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. :code:`
`:code:`
` NOTE: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. + + :ivar id: Resource Id. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Resource Id. + :paramtype id: str + """ + super(DiskEncryptionSetParameters, self).__init__(id=id, **kwargs) + + +class DiskEncryptionSettings(msrest.serialization.Model): + """Describes a Encryption Settings for a Disk. + + :ivar disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :vartype disk_encryption_key: ~azure.mgmt.compute.v2022_03_01.models.KeyVaultSecretReference + :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :vartype key_encryption_key: ~azure.mgmt.compute.v2022_03_01.models.KeyVaultKeyReference + :ivar enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :vartype enabled: bool + """ + + _attribute_map = { + 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultSecretReference'}, + 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultKeyReference'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + disk_encryption_key: Optional["KeyVaultSecretReference"] = None, + key_encryption_key: Optional["KeyVaultKeyReference"] = None, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.KeyVaultSecretReference + :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :paramtype key_encryption_key: ~azure.mgmt.compute.v2022_03_01.models.KeyVaultKeyReference + :keyword enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :paramtype enabled: bool + """ + super(DiskEncryptionSettings, self).__init__(**kwargs) + self.disk_encryption_key = disk_encryption_key + self.key_encryption_key = key_encryption_key + self.enabled = enabled + + +class DiskInstanceView(msrest.serialization.Model): + """The instance view of the 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. + :vartype encryption_settings: + list[~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSettings] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': '[DiskEncryptionSettings]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + encryption_settings: Optional[List["DiskEncryptionSettings"]] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.DiskEncryptionSettings] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + super(DiskInstanceView, self).__init__(**kwargs) + self.name = name + self.encryption_settings = encryption_settings + self.statuses = statuses + + +class DiskRestorePointInstanceView(msrest.serialization.Model): + """The instance view of a disk restore point. + + :ivar id: Disk restore point Id. + :vartype id: str + :ivar replication_status: The disk restore point replication status information. + :vartype replication_status: + ~azure.mgmt.compute.v2022_03_01.models.DiskRestorePointReplicationStatus + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'replication_status': {'key': 'replicationStatus', 'type': 'DiskRestorePointReplicationStatus'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + replication_status: Optional["DiskRestorePointReplicationStatus"] = None, + **kwargs + ): + """ + :keyword id: Disk restore point Id. + :paramtype id: str + :keyword replication_status: The disk restore point replication status information. + :paramtype replication_status: + ~azure.mgmt.compute.v2022_03_01.models.DiskRestorePointReplicationStatus + """ + super(DiskRestorePointInstanceView, self).__init__(**kwargs) + self.id = id + self.replication_status = replication_status + + +class DiskRestorePointReplicationStatus(msrest.serialization.Model): + """The instance view of a disk restore point. + + :ivar status: The resource status information. + :vartype status: ~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus + :ivar completion_percent: Replication completion percentage. + :vartype completion_percent: int + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'InstanceViewStatus'}, + 'completion_percent': {'key': 'completionPercent', 'type': 'int'}, + } + + def __init__( + self, + *, + status: Optional["InstanceViewStatus"] = None, + completion_percent: Optional[int] = None, + **kwargs + ): + """ + :keyword status: The resource status information. + :paramtype status: ~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus + :keyword completion_percent: Replication completion percentage. + :paramtype completion_percent: int + """ + super(DiskRestorePointReplicationStatus, self).__init__(**kwargs) + self.status = status + self.completion_percent = completion_percent + + +class ExtendedLocation(msrest.serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :vartype type: str or ~azure.mgmt.compute.v2022_03_01.models.ExtendedLocationTypes + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.ExtendedLocationTypes + """ + super(ExtendedLocation, self).__init__(**kwargs) + self.name = name + self.type = type + + +class HardwareProfile(msrest.serialization.Model): + """Specifies the hardware settings for the virtual machine. + + :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 + `_ + :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". + :vartype vm_size: str or ~azure.mgmt.compute.v2022_03_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. + :vartype vm_size_properties: ~azure.mgmt.compute.v2022_03_01.models.VMSizeProperties + """ + + _attribute_map = { + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'vm_size_properties': {'key': 'vmSizeProperties', 'type': 'VMSizeProperties'}, + } + + def __init__( + self, + *, + vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, + 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.v2022_03_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.v2022_03_01.models.VMSizeProperties + """ + super(HardwareProfile, self).__init__(**kwargs) + self.vm_size = vm_size + self.vm_size_properties = vm_size_properties + + +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 + :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.v2022_03_01.models.ExtendedLocation + :ivar source_virtual_machine: The source virtual machine from which Image is created. + :vartype source_virtual_machine: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2022_03_01.models.ImageStorageProfile + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :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.v2022_03_01.models.HyperVGenerationTypes + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + source_virtual_machine: Optional["SubResource"] = None, + storage_profile: Optional["ImageStorageProfile"] = None, + hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.ExtendedLocation + :keyword source_virtual_machine: The source virtual machine from which Image is created. + :paramtype source_virtual_machine: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2022_03_01.models.ImageStorageProfile + :keyword hyper_v_generation: Specifies the HyperVGenerationType of the VirtualMachine created + from the image. From API Version 2019-03-01 if the image source is a blob, then we need the + user to specify the value, if the source is managed resource like disk or snapshot, we may + require the user to specify the property if we cannot deduce it from the source managed + resource. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2022_03_01.models.HyperVGenerationTypes + """ + super(Image, self).__init__(location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.source_virtual_machine = source_virtual_machine + self.storage_profile = storage_profile + self.provisioning_state = None + self.hyper_v_generation = hyper_v_generation + + +class ImageDisk(msrest.serialization.Model): + """Describes a image disk. + + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :ivar disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :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", "PremiumV2_LRS". + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2022_03_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed image disk. + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + """ + + _attribute_map = { + 'snapshot': {'key': 'snapshot', 'type': 'SubResource'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'SubResource'}, + 'blob_uri': {'key': 'blobUri', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + } + + def __init__( + self, + *, + snapshot: Optional["SubResource"] = None, + managed_disk: Optional["SubResource"] = None, + blob_uri: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + disk_size_gb: Optional[int] = None, + storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, + disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, + **kwargs + ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :keyword disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS", "PremiumV2_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2022_03_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + """ + super(ImageDisk, self).__init__(**kwargs) + self.snapshot = snapshot + self.managed_disk = managed_disk + self.blob_uri = blob_uri + self.caching = caching + self.disk_size_gb = disk_size_gb + self.storage_account_type = storage_account_type + self.disk_encryption_set = disk_encryption_set + + +class ImageDataDisk(ImageDisk): + """Describes a data disk. + + All required parameters must be populated in order to send to Azure. + + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :ivar disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :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", "PremiumV2_LRS". + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2022_03_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed image disk. + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + :ivar lun: Required. Specifies the logical unit number of the data disk. This value is used to + identify data disks within the VM and therefore must be unique for each data disk attached to a + VM. + :vartype lun: int + """ + + _validation = { + 'lun': {'required': True}, + } + + _attribute_map = { + 'snapshot': {'key': 'snapshot', 'type': 'SubResource'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'SubResource'}, + 'blob_uri': {'key': 'blobUri', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + 'lun': {'key': 'lun', 'type': 'int'}, + } + + def __init__( + self, + *, + lun: int, + snapshot: Optional["SubResource"] = None, + managed_disk: Optional["SubResource"] = None, + blob_uri: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + disk_size_gb: Optional[int] = None, + storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, + disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, + **kwargs + ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :keyword disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS", "PremiumV2_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2022_03_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + :keyword lun: Required. Specifies the logical unit number of the data disk. This value is used + to identify data disks within the VM and therefore must be unique for each data disk attached + to a VM. + :paramtype lun: int + """ + super(ImageDataDisk, self).__init__(snapshot=snapshot, managed_disk=managed_disk, blob_uri=blob_uri, caching=caching, disk_size_gb=disk_size_gb, storage_account_type=storage_account_type, disk_encryption_set=disk_encryption_set, **kwargs) + self.lun = lun + + +class ImageListResult(msrest.serialization.Model): + """The List Image operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of Images. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.Image] + :ivar next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + the next page of Images. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Image]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Image"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of Images. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.Image] + :keyword next_link: The uri to fetch the next page of Images. Call ListNext() with this to + fetch the next page of Images. + :paramtype next_link: str + """ + super(ImageListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ImageOSDisk(ImageDisk): + """Describes an Operating System disk. + + All required parameters must be populated in order to send to Azure. + + :ivar snapshot: The snapshot. + :vartype snapshot: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar managed_disk: The managedDisk. + :vartype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar blob_uri: The Virtual Hard Disk. + :vartype blob_uri: str + :ivar caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :ivar disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :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", "PremiumV2_LRS". + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2022_03_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed image disk. + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + :ivar os_type: Required. This property allows you to specify the type of the OS that is + included in the disk if creating a VM from a custom image. :code:`
`:code:`
` Possible + values are: :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible + values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemTypes + :ivar os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :vartype os_state: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemStateTypes + """ + + _validation = { + 'os_type': {'required': True}, + 'os_state': {'required': True}, + } + + _attribute_map = { + 'snapshot': {'key': 'snapshot', 'type': 'SubResource'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'SubResource'}, + 'blob_uri': {'key': 'blobUri', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'os_state': {'key': 'osState', 'type': 'str'}, + } + + def __init__( + self, + *, + os_type: Union[str, "OperatingSystemTypes"], + os_state: Union[str, "OperatingSystemStateTypes"], + snapshot: Optional["SubResource"] = None, + managed_disk: Optional["SubResource"] = None, + blob_uri: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + disk_size_gb: Optional[int] = None, + storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, + disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, + **kwargs + ): + """ + :keyword snapshot: The snapshot. + :paramtype snapshot: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword managed_disk: The managedDisk. + :paramtype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword blob_uri: The Virtual Hard Disk. + :paramtype blob_uri: str + :keyword caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :keyword disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :paramtype disk_size_gb: int + :keyword storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS", "PremiumV2_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2022_03_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed image disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + :keyword os_type: Required. This property allows you to specify the type of the OS that is + included in the disk if creating a VM from a custom image. :code:`
`:code:`
` Possible + values are: :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible + values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemTypes + :keyword os_state: Required. The OS State. Possible values include: "Generalized", + "Specialized". + :paramtype os_state: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemStateTypes + """ + super(ImageOSDisk, self).__init__(snapshot=snapshot, managed_disk=managed_disk, blob_uri=blob_uri, caching=caching, disk_size_gb=disk_size_gb, storage_account_type=storage_account_type, disk_encryption_set=disk_encryption_set, **kwargs) + self.os_type = os_type + self.os_state = os_state + + +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. + + :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. + :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. Please do not use field 'version' for gallery + image deployment, gallery image should always use 'id' field for deployment, to use 'latest' + version of gallery image, just set + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' + in the 'id' field without version input. + :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 + :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. + :vartype shared_gallery_image_id: str + :ivar community_gallery_image_id: Specified the community gallery image unique id for vm + deployment. This can be fetched from community gallery image GET call. + :vartype community_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'}, + 'community_gallery_image_id': {'key': 'communityGalleryImageId', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + publisher: Optional[str] = None, + offer: Optional[str] = None, + sku: Optional[str] = None, + version: Optional[str] = None, + shared_gallery_image_id: Optional[str] = None, + community_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. Please do not use field 'version' + for gallery image deployment, gallery image should always use 'id' field for deployment, to use + 'latest' version of gallery image, just set + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageName}' + in the 'id' field without version input. + :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 + :keyword community_gallery_image_id: Specified the community gallery image unique id for vm + deployment. This can be fetched from community gallery image GET call. + :paramtype community_gallery_image_id: str + """ + super(ImageReference, self).__init__(id=id, **kwargs) + self.publisher = publisher + self.offer = offer + self.sku = sku + self.version = version + self.exact_version = None + self.shared_gallery_image_id = shared_gallery_image_id + self.community_gallery_image_id = community_gallery_image_id + + +class ImageStorageProfile(msrest.serialization.Model): + """Describes a storage profile. + + :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 + `_. + :vartype os_disk: ~azure.mgmt.compute.v2022_03_01.models.ImageOSDisk + :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs + for Azure virtual machines + `_. + :vartype data_disks: list[~azure.mgmt.compute.v2022_03_01.models.ImageDataDisk] + :ivar zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). + :vartype zone_resilient: bool + """ + + _attribute_map = { + 'os_disk': {'key': 'osDisk', 'type': 'ImageOSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[ImageDataDisk]'}, + 'zone_resilient': {'key': 'zoneResilient', 'type': 'bool'}, + } + + def __init__( + self, + *, + os_disk: Optional["ImageOSDisk"] = None, + data_disks: Optional[List["ImageDataDisk"]] = None, + zone_resilient: Optional[bool] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.ImageOSDisk + :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs + for Azure virtual machines + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2022_03_01.models.ImageDataDisk] + :keyword zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). + :paramtype zone_resilient: bool + """ + super(ImageStorageProfile, self).__init__(**kwargs) + self.os_disk = os_disk + self.data_disks = data_disks + self.zone_resilient = zone_resilient + + +class ImageUpdate(UpdateResource): + """The source user image virtual hard disk. Only tags may be updated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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.v2022_03_01.models.SubResource + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2022_03_01.models.ImageStorageProfile + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :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.v2022_03_01.models.HyperVGenerationTypes + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + source_virtual_machine: Optional["SubResource"] = None, + storage_profile: Optional["ImageStorageProfile"] = None, + hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.SubResource + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2022_03_01.models.ImageStorageProfile + :keyword hyper_v_generation: Specifies the HyperVGenerationType of the VirtualMachine created + from the image. From API Version 2019-03-01 if the image source is a blob, then we need the + user to specify the value, if the source is managed resource like disk or snapshot, we may + require the user to specify the property if we cannot deduce it from the source managed + resource. Possible values include: "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2022_03_01.models.HyperVGenerationTypes + """ + super(ImageUpdate, self).__init__(tags=tags, **kwargs) + self.source_virtual_machine = source_virtual_machine + self.storage_profile = storage_profile + self.provisioning_state = None + self.hyper_v_generation = hyper_v_generation + + +class InnerError(msrest.serialization.Model): + """Inner error details. + + :ivar exceptiontype: The exception type. + :vartype exceptiontype: str + :ivar errordetail: The internal error message or exception dump. + :vartype errordetail: str + """ + + _attribute_map = { + 'exceptiontype': {'key': 'exceptiontype', 'type': 'str'}, + 'errordetail': {'key': 'errordetail', 'type': 'str'}, + } + + def __init__( + self, + *, + exceptiontype: Optional[str] = None, + errordetail: Optional[str] = None, + **kwargs + ): + """ + :keyword exceptiontype: The exception type. + :paramtype exceptiontype: str + :keyword errordetail: The internal error message or exception dump. + :paramtype errordetail: str + """ + super(InnerError, self).__init__(**kwargs) + self.exceptiontype = exceptiontype + self.errordetail = errordetail + + +class InstanceViewStatus(msrest.serialization.Model): + """Instance view status. + + :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.v2022_03_01.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'level': {'key': 'level', 'type': 'str'}, + 'display_status': {'key': 'displayStatus', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'time': {'key': 'time', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + level: Optional[Union[str, "StatusLevelTypes"]] = None, + display_status: Optional[str] = None, + message: Optional[str] = None, + time: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.StatusLevelTypes + :keyword display_status: The short localizable label for the status. + :paramtype display_status: str + :keyword message: The detailed status message, including for alerts and error messages. + :paramtype message: str + :keyword time: The time of the status. + :paramtype time: ~datetime.datetime + """ + super(InstanceViewStatus, self).__init__(**kwargs) + self.code = code + self.level = level + self.display_status = display_status + self.message = message + self.time = time + + +class KeyVaultKeyReference(msrest.serialization.Model): + """Describes a reference to Key Vault Key. + + All required parameters must be populated in order to send to Azure. + + :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.v2022_03_01.models.SubResource + """ + + _validation = { + 'key_url': {'required': True}, + 'source_vault': {'required': True}, + } + + _attribute_map = { + 'key_url': {'key': 'keyUrl', 'type': 'str'}, + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + } + + def __init__( + self, + *, + key_url: str, + source_vault: "SubResource", + **kwargs + ): + """ + :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.v2022_03_01.models.SubResource + """ + super(KeyVaultKeyReference, self).__init__(**kwargs) + self.key_url = key_url + self.source_vault = source_vault + + +class KeyVaultSecretReference(msrest.serialization.Model): + """Describes a reference to Key Vault Secret. + + All required parameters must be populated in order to send to Azure. + + :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.v2022_03_01.models.SubResource + """ + + _validation = { + 'secret_url': {'required': True}, + 'source_vault': {'required': True}, + } + + _attribute_map = { + 'secret_url': {'key': 'secretUrl', 'type': 'str'}, + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + } + + def __init__( + self, + *, + secret_url: str, + source_vault: "SubResource", + **kwargs + ): + """ + :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.v2022_03_01.models.SubResource + """ + super(KeyVaultSecretReference, self).__init__(**kwargs) + self.secret_url = secret_url + self.source_vault = source_vault + + +class LastPatchInstallationSummary(msrest.serialization.Model): + """Describes the properties of the last installed patch summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2022_03_01.models.PatchOperationStatus + :ivar installation_activity_id: The activity ID of the operation that produced this result. It + is used to correlate across CRP and extension logs. + :vartype installation_activity_id: str + :ivar maintenance_window_exceeded: Describes whether the operation ran out of time before it + completed all its intended actions. + :vartype maintenance_window_exceeded: bool + :ivar not_selected_patch_count: The number of all available patches but not going to be + installed because it didn't match a classification or inclusion list entry. + :vartype not_selected_patch_count: int + :ivar excluded_patch_count: The number of all available patches but excluded explicitly by a + customer-specified exclusion list match. + :vartype excluded_patch_count: int + :ivar pending_patch_count: The number of all available patches expected to be installed over + the course of the patch installation operation. + :vartype pending_patch_count: int + :ivar installed_patch_count: The count of patches that successfully installed. + :vartype installed_patch_count: int + :ivar failed_patch_count: The count of patches that failed installation. + :vartype failed_patch_count: int + :ivar start_time: The UTC timestamp when the operation began. + :vartype start_time: ~datetime.datetime + :ivar last_modified_time: The UTC timestamp when the operation began. + :vartype last_modified_time: ~datetime.datetime + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2022_03_01.models.ApiError + """ + + _validation = { + 'status': {'readonly': True}, + 'installation_activity_id': {'readonly': True}, + 'maintenance_window_exceeded': {'readonly': True}, + 'not_selected_patch_count': {'readonly': True}, + 'excluded_patch_count': {'readonly': True}, + 'pending_patch_count': {'readonly': True}, + 'installed_patch_count': {'readonly': True}, + 'failed_patch_count': {'readonly': True}, + 'start_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'installation_activity_id': {'key': 'installationActivityId', 'type': 'str'}, + 'maintenance_window_exceeded': {'key': 'maintenanceWindowExceeded', 'type': 'bool'}, + 'not_selected_patch_count': {'key': 'notSelectedPatchCount', 'type': 'int'}, + 'excluded_patch_count': {'key': 'excludedPatchCount', 'type': 'int'}, + 'pending_patch_count': {'key': 'pendingPatchCount', 'type': 'int'}, + 'installed_patch_count': {'key': 'installedPatchCount', 'type': 'int'}, + 'failed_patch_count': {'key': 'failedPatchCount', 'type': 'int'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(LastPatchInstallationSummary, self).__init__(**kwargs) + self.status = None + self.installation_activity_id = None + self.maintenance_window_exceeded = None + self.not_selected_patch_count = None + self.excluded_patch_count = None + self.pending_patch_count = None + self.installed_patch_count = None + self.failed_patch_count = None + self.start_time = None + self.last_modified_time = None + self.error = None + + +class LinuxConfiguration(msrest.serialization.Model): + """Specifies the Linux operating system settings on the virtual machine. :code:`
`:code:`
`For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions `_. + + :ivar disable_password_authentication: Specifies whether password authentication should be + disabled. + :vartype disable_password_authentication: bool + :ivar ssh: Specifies the ssh key configuration for a Linux OS. + :vartype ssh: ~azure.mgmt.compute.v2022_03_01.models.SshConfiguration + :ivar provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + virtual machine. :code:`
`:code:`
` When this property is not specified in the request + body, default behavior is to set it to true. This will ensure that VM Agent is installed on + the VM so that extensions can be added to the VM later. + :vartype provision_vm_agent: bool + :ivar patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Linux. + :vartype patch_settings: ~azure.mgmt.compute.v2022_03_01.models.LinuxPatchSettings + """ + + _attribute_map = { + 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, + 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, + 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, + 'patch_settings': {'key': 'patchSettings', 'type': 'LinuxPatchSettings'}, + } + + def __init__( + self, + *, + disable_password_authentication: Optional[bool] = None, + ssh: Optional["SshConfiguration"] = None, + provision_vm_agent: Optional[bool] = None, + patch_settings: Optional["LinuxPatchSettings"] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.SshConfiguration + :keyword provision_vm_agent: Indicates whether virtual machine agent should be provisioned on + the virtual machine. :code:`
`:code:`
` When this property is not specified in the + request body, default behavior is to set it to true. This will ensure that VM Agent is + installed on the VM so that extensions can be added to the VM later. + :paramtype provision_vm_agent: bool + :keyword patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Linux. + :paramtype patch_settings: ~azure.mgmt.compute.v2022_03_01.models.LinuxPatchSettings + """ + super(LinuxConfiguration, self).__init__(**kwargs) + self.disable_password_authentication = disable_password_authentication + self.ssh = ssh + self.provision_vm_agent = provision_vm_agent + self.patch_settings = patch_settings + + +class LinuxParameters(msrest.serialization.Model): + """Input for InstallPatches on a Linux VM, as directly received by the API. + + :ivar classifications_to_include: The update classifications to select when installing patches + for Linux. + :vartype classifications_to_include: list[str or + ~azure.mgmt.compute.v2022_03_01.models.VMGuestPatchClassificationLinux] + :ivar package_name_masks_to_include: packages to include in the patch operation. Format: + packageName_packageVersion. + :vartype package_name_masks_to_include: list[str] + :ivar package_name_masks_to_exclude: packages to exclude in the patch operation. Format: + packageName_packageVersion. + :vartype package_name_masks_to_exclude: list[str] + :ivar maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest + Patching in Linux. + :vartype maintenance_run_id: str + """ + + _attribute_map = { + 'classifications_to_include': {'key': 'classificationsToInclude', 'type': '[str]'}, + 'package_name_masks_to_include': {'key': 'packageNameMasksToInclude', 'type': '[str]'}, + 'package_name_masks_to_exclude': {'key': 'packageNameMasksToExclude', 'type': '[str]'}, + 'maintenance_run_id': {'key': 'maintenanceRunId', 'type': 'str'}, + } + + def __init__( + self, + *, + classifications_to_include: Optional[List[Union[str, "VMGuestPatchClassificationLinux"]]] = None, + package_name_masks_to_include: Optional[List[str]] = None, + package_name_masks_to_exclude: Optional[List[str]] = None, + maintenance_run_id: Optional[str] = None, + **kwargs + ): + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Linux. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.compute.v2022_03_01.models.VMGuestPatchClassificationLinux] + :keyword package_name_masks_to_include: packages to include in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_include: list[str] + :keyword package_name_masks_to_exclude: packages to exclude in the patch operation. Format: + packageName_packageVersion. + :paramtype package_name_masks_to_exclude: list[str] + :keyword maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest + Patching in Linux. + :paramtype maintenance_run_id: str + """ + super(LinuxParameters, self).__init__(**kwargs) + self.classifications_to_include = classifications_to_include + self.package_name_masks_to_include = package_name_masks_to_include + self.package_name_masks_to_exclude = package_name_masks_to_exclude + self.maintenance_run_id = maintenance_run_id + + +class LinuxPatchSettings(msrest.serialization.Model): + """Specifies settings related to VM Guest Patching on Linux. + + :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". + :vartype patch_mode: str or ~azure.mgmt.compute.v2022_03_01.models.LinuxVMGuestPatchMode + :ivar assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + machine.:code:`
`:code:`
` Possible values are::code:`
`:code:`
` + **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
`:code:`
` **AutomaticByPlatform** - The platform will trigger periodic patch + assessments. The property provisionVMAgent must be true. Possible values include: + "ImageDefault", "AutomaticByPlatform". + :vartype assessment_mode: str or + ~azure.mgmt.compute.v2022_03_01.models.LinuxPatchAssessmentMode + :ivar automatic_by_platform_settings: Specifies additional settings for patch mode + AutomaticByPlatform in VM Guest Patching on Linux. + :vartype automatic_by_platform_settings: + ~azure.mgmt.compute.v2022_03_01.models.LinuxVMGuestPatchAutomaticByPlatformSettings + """ + + _attribute_map = { + 'patch_mode': {'key': 'patchMode', 'type': 'str'}, + 'assessment_mode': {'key': 'assessmentMode', 'type': 'str'}, + 'automatic_by_platform_settings': {'key': 'automaticByPlatformSettings', 'type': 'LinuxVMGuestPatchAutomaticByPlatformSettings'}, + } + + def __init__( + self, + *, + patch_mode: Optional[Union[str, "LinuxVMGuestPatchMode"]] = None, + assessment_mode: Optional[Union[str, "LinuxPatchAssessmentMode"]] = None, + automatic_by_platform_settings: Optional["LinuxVMGuestPatchAutomaticByPlatformSettings"] = 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.v2022_03_01.models.LinuxVMGuestPatchMode + :keyword assessment_mode: Specifies the mode of VM Guest Patch Assessment for the IaaS virtual + machine.:code:`
`:code:`
` Possible values are::code:`
`:code:`
` + **ImageDefault** - You control the timing of patch assessments on a virtual machine. :code:`
`:code:`
` **AutomaticByPlatform** - The platform will trigger periodic patch + assessments. The property provisionVMAgent must be true. Possible values include: + "ImageDefault", "AutomaticByPlatform". + :paramtype assessment_mode: str or + ~azure.mgmt.compute.v2022_03_01.models.LinuxPatchAssessmentMode + :keyword automatic_by_platform_settings: Specifies additional settings for patch mode + AutomaticByPlatform in VM Guest Patching on Linux. + :paramtype automatic_by_platform_settings: + ~azure.mgmt.compute.v2022_03_01.models.LinuxVMGuestPatchAutomaticByPlatformSettings + """ + super(LinuxPatchSettings, self).__init__(**kwargs) + self.patch_mode = patch_mode + self.assessment_mode = assessment_mode + self.automatic_by_platform_settings = automatic_by_platform_settings + + +class LinuxVMGuestPatchAutomaticByPlatformSettings(msrest.serialization.Model): + """Specifies additional settings to be applied when patch mode AutomaticByPlatform is selected in Linux patch settings. + + :ivar reboot_setting: Specifies the reboot setting for all AutomaticByPlatform patch + installation operations. Possible values include: "Unknown", "IfRequired", "Never", "Always". + :vartype reboot_setting: str or + ~azure.mgmt.compute.v2022_03_01.models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting + """ + + _attribute_map = { + 'reboot_setting': {'key': 'rebootSetting', 'type': 'str'}, + } + + def __init__( + self, + *, + reboot_setting: Optional[Union[str, "LinuxVMGuestPatchAutomaticByPlatformRebootSetting"]] = None, + **kwargs + ): + """ + :keyword reboot_setting: Specifies the reboot setting for all AutomaticByPlatform patch + installation operations. Possible values include: "Unknown", "IfRequired", "Never", "Always". + :paramtype reboot_setting: str or + ~azure.mgmt.compute.v2022_03_01.models.LinuxVMGuestPatchAutomaticByPlatformRebootSetting + """ + super(LinuxVMGuestPatchAutomaticByPlatformSettings, self).__init__(**kwargs) + self.reboot_setting = reboot_setting + + +class ListUsagesResult(msrest.serialization.Model): + """The List Usages operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of compute resource usages. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.Usage] + :ivar next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Usage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Usage"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of compute resource usages. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.Usage] + :keyword next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :paramtype next_link: str + """ + super(ListUsagesResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class LogAnalyticsInputBase(msrest.serialization.Model): + """Api input base class for LogAnalytics Api. + + All required parameters must be populated in order to send to Azure. + + :ivar blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :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 = { + 'blob_container_sas_uri': {'required': True}, + 'from_time': {'required': True}, + 'to_time': {'required': True}, + } + + _attribute_map = { + 'blob_container_sas_uri': {'key': 'blobContainerSasUri', 'type': 'str'}, + 'from_time': {'key': 'fromTime', 'type': 'iso-8601'}, + 'to_time': {'key': 'toTime', 'type': 'iso-8601'}, + 'group_by_throttle_policy': {'key': 'groupByThrottlePolicy', 'type': 'bool'}, + 'group_by_operation_name': {'key': 'groupByOperationName', 'type': 'bool'}, + 'group_by_resource_name': {'key': 'groupByResourceName', 'type': 'bool'}, + 'group_by_client_application_id': {'key': 'groupByClientApplicationId', 'type': 'bool'}, + 'group_by_user_agent': {'key': 'groupByUserAgent', 'type': 'bool'}, + } + + def __init__( + self, + *, + blob_container_sas_uri: str, + from_time: datetime.datetime, + to_time: datetime.datetime, + group_by_throttle_policy: Optional[bool] = None, + group_by_operation_name: Optional[bool] = None, + group_by_resource_name: Optional[bool] = None, + group_by_client_application_id: Optional[bool] = None, + group_by_user_agent: Optional[bool] = None, + **kwargs + ): + """ + :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 + self.to_time = to_time + self.group_by_throttle_policy = group_by_throttle_policy + self.group_by_operation_name = group_by_operation_name + self.group_by_resource_name = group_by_resource_name + self.group_by_client_application_id = group_by_client_application_id + self.group_by_user_agent = group_by_user_agent + + +class LogAnalyticsOperationResult(msrest.serialization.Model): + """LogAnalytics operation status response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar properties: LogAnalyticsOutput. + :vartype properties: ~azure.mgmt.compute.v2022_03_01.models.LogAnalyticsOutput + """ + + _validation = { + 'properties': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'LogAnalyticsOutput'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(LogAnalyticsOperationResult, self).__init__(**kwargs) + self.properties = None + + +class LogAnalyticsOutput(msrest.serialization.Model): + """LogAnalytics output properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar output: Output file Uri path to blob container. + :vartype output: str + """ + + _validation = { + 'output': {'readonly': True}, + } + + _attribute_map = { + 'output': {'key': 'output', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(LogAnalyticsOutput, self).__init__(**kwargs) + self.output = None + + +class MaintenanceRedeployStatus(msrest.serialization.Model): + """Maintenance Operation Status. + + :ivar is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :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". + :vartype last_operation_result_code: str or + ~azure.mgmt.compute.v2022_03_01.models.MaintenanceOperationResultCodeTypes + :ivar last_operation_message: Message returned for the last Maintenance Operation. + :vartype last_operation_message: str + """ + + _attribute_map = { + 'is_customer_initiated_maintenance_allowed': {'key': 'isCustomerInitiatedMaintenanceAllowed', 'type': 'bool'}, + 'pre_maintenance_window_start_time': {'key': 'preMaintenanceWindowStartTime', 'type': 'iso-8601'}, + 'pre_maintenance_window_end_time': {'key': 'preMaintenanceWindowEndTime', 'type': 'iso-8601'}, + 'maintenance_window_start_time': {'key': 'maintenanceWindowStartTime', 'type': 'iso-8601'}, + 'maintenance_window_end_time': {'key': 'maintenanceWindowEndTime', 'type': 'iso-8601'}, + 'last_operation_result_code': {'key': 'lastOperationResultCode', 'type': 'str'}, + 'last_operation_message': {'key': 'lastOperationMessage', 'type': 'str'}, + } + + def __init__( + self, + *, + is_customer_initiated_maintenance_allowed: Optional[bool] = None, + pre_maintenance_window_start_time: Optional[datetime.datetime] = None, + pre_maintenance_window_end_time: Optional[datetime.datetime] = None, + maintenance_window_start_time: Optional[datetime.datetime] = None, + maintenance_window_end_time: Optional[datetime.datetime] = None, + last_operation_result_code: Optional[Union[str, "MaintenanceOperationResultCodeTypes"]] = None, + last_operation_message: Optional[str] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.MaintenanceOperationResultCodeTypes + :keyword last_operation_message: Message returned for the last Maintenance Operation. + :paramtype last_operation_message: str + """ + super(MaintenanceRedeployStatus, self).__init__(**kwargs) + self.is_customer_initiated_maintenance_allowed = is_customer_initiated_maintenance_allowed + self.pre_maintenance_window_start_time = pre_maintenance_window_start_time + self.pre_maintenance_window_end_time = pre_maintenance_window_end_time + self.maintenance_window_start_time = maintenance_window_start_time + self.maintenance_window_end_time = maintenance_window_end_time + self.last_operation_result_code = last_operation_result_code + self.last_operation_message = last_operation_message + + +class ManagedDiskParameters(SubResource): + """The parameters of a managed disk. + + :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", "PremiumV2_LRS". + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2022_03_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed disk. + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + :ivar security_profile: Specifies the security profile for the managed disk. + :vartype security_profile: ~azure.mgmt.compute.v2022_03_01.models.VMDiskSecurityProfile + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + 'security_profile': {'key': 'securityProfile', 'type': 'VMDiskSecurityProfile'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, + disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, + security_profile: Optional["VMDiskSecurityProfile"] = 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", "PremiumV2_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2022_03_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + :keyword security_profile: Specifies the security profile for the managed disk. + :paramtype security_profile: ~azure.mgmt.compute.v2022_03_01.models.VMDiskSecurityProfile + """ + super(ManagedDiskParameters, self).__init__(id=id, **kwargs) + self.storage_account_type = storage_account_type + self.disk_encryption_set = disk_encryption_set + self.security_profile = security_profile + + +class NetworkInterfaceReference(SubResource): + """Describes a network interface reference. + + :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. + :vartype primary: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DeleteOptions + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + primary: Optional[bool] = None, + 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.v2022_03_01.models.DeleteOptions + """ + super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) + self.primary = primary + self.delete_option = delete_option + + +class NetworkProfile(msrest.serialization.Model): + """Specifies the network interfaces or the networking configuration of the virtual machine. + + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :vartype network_interfaces: + list[~azure.mgmt.compute.v2022_03_01.models.NetworkInterfaceReference] + :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". + :vartype network_api_version: str or ~azure.mgmt.compute.v2022_03_01.models.NetworkApiVersion + :ivar network_interface_configurations: Specifies the networking configurations that will be + used to create the virtual machine networking resources. + :vartype network_interface_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineNetworkInterfaceConfiguration] + """ + + _attribute_map = { + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterfaceReference]'}, + 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, + 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineNetworkInterfaceConfiguration]'}, + } + + def __init__( + self, + *, + network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, + network_api_version: Optional[Union[str, "NetworkApiVersion"]] = None, + 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.v2022_03_01.models.NetworkInterfaceReference] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations. Possible values include: + "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2022_03_01.models.NetworkApiVersion + :keyword network_interface_configurations: Specifies the networking configurations that will be + used to create the virtual machine networking resources. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineNetworkInterfaceConfiguration] + """ + super(NetworkProfile, self).__init__(**kwargs) + self.network_interfaces = network_interfaces + self.network_api_version = network_api_version + self.network_interface_configurations = network_interface_configurations + + +class OrchestrationServiceStateInput(msrest.serialization.Model): + """The input for OrchestrationServiceState. + + All required parameters must be populated in order to send to Azure. + + :ivar service_name: Required. The name of the service. Possible values include: + "AutomaticRepairs", "DummyOrchestrationServiceName". + :vartype service_name: str or ~azure.mgmt.compute.v2022_03_01.models.OrchestrationServiceNames + :ivar action: Required. The action to be performed. Possible values include: "Resume", + "Suspend". + :vartype action: str or ~azure.mgmt.compute.v2022_03_01.models.OrchestrationServiceStateAction + """ + + _validation = { + 'service_name': {'required': True}, + 'action': {'required': True}, + } + + _attribute_map = { + 'service_name': {'key': 'serviceName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + *, + service_name: Union[str, "OrchestrationServiceNames"], + action: Union[str, "OrchestrationServiceStateAction"], + **kwargs + ): + """ + :keyword service_name: Required. The name of the service. Possible values include: + "AutomaticRepairs", "DummyOrchestrationServiceName". + :paramtype service_name: str or + ~azure.mgmt.compute.v2022_03_01.models.OrchestrationServiceNames + :keyword action: Required. The action to be performed. Possible values include: "Resume", + "Suspend". + :paramtype action: str or + ~azure.mgmt.compute.v2022_03_01.models.OrchestrationServiceStateAction + """ + super(OrchestrationServiceStateInput, self).__init__(**kwargs) + self.service_name = service_name + self.action = action + + +class OrchestrationServiceSummary(msrest.serialization.Model): + """Summary for an orchestration service of a virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_name: The name of the service. Possible values include: "AutomaticRepairs", + "DummyOrchestrationServiceName". + :vartype service_name: str or ~azure.mgmt.compute.v2022_03_01.models.OrchestrationServiceNames + :ivar service_state: The current state of the service. Possible values include: "NotRunning", + "Running", "Suspended". + :vartype service_state: str or ~azure.mgmt.compute.v2022_03_01.models.OrchestrationServiceState + """ + + _validation = { + 'service_name': {'readonly': True}, + 'service_state': {'readonly': True}, + } + + _attribute_map = { + 'service_name': {'key': 'serviceName', 'type': 'str'}, + 'service_state': {'key': 'serviceState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OrchestrationServiceSummary, self).__init__(**kwargs) + self.service_name = None + self.service_state = None + + +class OSDisk(msrest.serialization.Model): + """Specifies information about the operating system disk used by the virtual machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs for Azure virtual machines `_. + + All required parameters must be populated in order to send to Azure. + + :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". + :vartype os_type: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemTypes + :ivar encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
`:code:`
` Minimum api-version: 2015-06-15. + :vartype encryption_settings: ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSettings + :ivar name: The disk name. + :vartype name: str + :ivar vhd: The virtual hard disk. + :vartype vhd: ~azure.mgmt.compute.v2022_03_01.models.VirtualHardDisk + :ivar image: The source user image virtual hard disk. The virtual hard disk will be copied + before being attached to the virtual machine. If SourceImage is provided, the destination + virtual hard drive must not exist. + :vartype image: ~azure.mgmt.compute.v2022_03_01.models.VirtualHardDisk + :ivar caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None** for Standard + storage. **ReadOnly** for Premium storage. Possible values include: "None", "ReadOnly", + "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :ivar write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the 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. + :vartype diff_disk_settings: ~azure.mgmt.compute.v2022_03_01.models.DiffDiskSettings + :ivar create_option: Required. Specifies how the virtual machine should be + created.:code:`
`:code:`
` Possible values are::code:`
`:code:`
` **Attach** \u2013 + This value is used when you are using a specialized disk to create the virtual + machine.:code:`
`:code:`
` **FromImage** \u2013 This value is used when you are using an + image to create the virtual machine. If you are using a platform image, you also use the + imageReference element described above. If you are using a marketplace image, you also use the + plan element previously described. Possible values include: "FromImage", "Empty", "Attach". + :vartype create_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskCreateOptionTypes + :ivar disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + used to overwrite the size of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.ManagedDiskParameters + :ivar delete_option: Specifies whether OS Disk should be deleted or detached upon VM deletion. + :code:`
`:code:`
` Possible values: :code:`
`:code:`
` **Delete** If this value is + used, the OS disk is deleted when VM is deleted.:code:`
`:code:`
` **Detach** If this + value is used, the os disk is retained after VM is deleted. :code:`
`:code:`
` The + default value is set to **detach**. For an ephemeral OS Disk, the default value is set to + **Delete**. User cannot change the delete option for ephemeral OS Disk. Possible values + include: "Delete", "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskDeleteOptionTypes + """ + + _validation = { + 'create_option': {'required': True}, + } + + _attribute_map = { + 'os_type': {'key': 'osType', 'type': 'str'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': 'DiskEncryptionSettings'}, + 'name': {'key': 'name', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'diff_disk_settings': {'key': 'diffDiskSettings', 'type': 'DiffDiskSettings'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, + 'delete_option': {'key': 'deleteOption', 'type': 'str'}, + } + + def __init__( + self, + *, + create_option: Union[str, "DiskCreateOptionTypes"], + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + encryption_settings: Optional["DiskEncryptionSettings"] = None, + name: Optional[str] = None, + vhd: Optional["VirtualHardDisk"] = None, + image: Optional["VirtualHardDisk"] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + diff_disk_settings: Optional["DiffDiskSettings"] = None, + disk_size_gb: Optional[int] = None, + managed_disk: Optional["ManagedDiskParameters"] = None, + 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.v2022_03_01.models.OperatingSystemTypes + :keyword encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
`:code:`
` Minimum api-version: 2015-06-15. + :paramtype encryption_settings: ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSettings + :keyword name: The disk name. + :paramtype name: str + :keyword vhd: The virtual hard disk. + :paramtype vhd: ~azure.mgmt.compute.v2022_03_01.models.VirtualHardDisk + :keyword image: The source user image virtual hard disk. The virtual hard disk will be copied + before being attached to the virtual machine. If SourceImage is provided, the destination + virtual hard drive must not exist. + :paramtype image: ~azure.mgmt.compute.v2022_03_01.models.VirtualHardDisk + :keyword caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None** for Standard + storage. **ReadOnly** for Premium storage. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system + disk used by the virtual machine. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2022_03_01.models.DiffDiskSettings + :keyword create_option: Required. Specifies how the virtual machine should be + created.:code:`
`:code:`
` Possible values are::code:`
`:code:`
` **Attach** \u2013 + This value is used when you are using a specialized disk to create the virtual + machine.:code:`
`:code:`
` **FromImage** \u2013 This value is used when you are using an + image to create the virtual machine. If you are using a platform image, you also use the + imageReference element described above. If you are using a marketplace image, you also use the + plan element previously described. Possible values include: "FromImage", "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskCreateOptionTypes + :keyword disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can + be used to overwrite the size of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.ManagedDiskParameters + :keyword delete_option: Specifies whether OS Disk should be deleted or detached upon VM + deletion. :code:`
`:code:`
` Possible values: :code:`
`:code:`
` **Delete** If this + value is used, the OS disk is deleted when VM is deleted.:code:`
`:code:`
` **Detach** If + this value is used, the os disk is retained after VM is deleted. :code:`
`:code:`
` The + default value is set to **detach**. For an ephemeral OS Disk, the default value is set to + **Delete**. User cannot change the delete option for ephemeral OS Disk. Possible values + include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskDeleteOptionTypes + """ + super(OSDisk, self).__init__(**kwargs) + self.os_type = os_type + self.encryption_settings = encryption_settings + self.name = name + self.vhd = vhd + self.image = image + self.caching = caching + self.write_accelerator_enabled = write_accelerator_enabled + self.diff_disk_settings = diff_disk_settings + self.create_option = create_option + self.disk_size_gb = disk_size_gb + self.managed_disk = managed_disk + self.delete_option = delete_option + + +class OSDiskImage(msrest.serialization.Model): + """Contains the os disk image information. + + All required parameters must be populated in order to send to Azure. + + :ivar operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :vartype operating_system: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemTypes + """ + + _validation = { + 'operating_system': {'required': True}, + } + + _attribute_map = { + 'operating_system': {'key': 'operatingSystem', 'type': 'str'}, + } + + def __init__( + self, + *, + operating_system: Union[str, "OperatingSystemTypes"], + **kwargs + ): + """ + :keyword operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :paramtype operating_system: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemTypes + """ + super(OSDiskImage, self).__init__(**kwargs) + self.operating_system = operating_system + + +class OSProfile(msrest.serialization.Model): + """Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once VM is provisioned. + + :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 + `_. + :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 + :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 + `_. + :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 + 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 + `_. + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :vartype windows_configuration: ~azure.mgmt.compute.v2022_03_01.models.WindowsConfiguration + :ivar linux_configuration: Specifies the Linux operating system settings on the virtual + machine. :code:`
`:code:`
`For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions + `_. + :vartype linux_configuration: ~azure.mgmt.compute.v2022_03_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machine. + To install certificates on a virtual machine it is recommended to use the `Azure Key Vault + virtual machine extension for Linux + `_ or the `Azure + Key Vault virtual machine extension for Windows + `_. + :vartype secrets: list[~azure.mgmt.compute.v2022_03_01.models.VaultSecretGroup] + :ivar allow_extension_operations: Specifies whether extension operations should be allowed on + the virtual machine. :code:`
`:code:`
`This may only be set to False when no extensions + are present on the virtual machine. + :vartype allow_extension_operations: bool + :ivar require_guest_provision_signal: Optional property which must either be set to True or + omitted. + :vartype require_guest_provision_signal: bool + """ + + _attribute_map = { + 'computer_name': {'key': 'computerName', 'type': 'str'}, + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + 'custom_data': {'key': 'customData', 'type': 'str'}, + 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'WindowsConfiguration'}, + 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'LinuxConfiguration'}, + 'secrets': {'key': 'secrets', 'type': '[VaultSecretGroup]'}, + 'allow_extension_operations': {'key': 'allowExtensionOperations', 'type': 'bool'}, + 'require_guest_provision_signal': {'key': 'requireGuestProvisionSignal', 'type': 'bool'}, + } + + def __init__( + self, + *, + computer_name: Optional[str] = None, + admin_username: Optional[str] = None, + admin_password: Optional[str] = None, + custom_data: Optional[str] = None, + windows_configuration: Optional["WindowsConfiguration"] = None, + linux_configuration: Optional["LinuxConfiguration"] = None, + secrets: Optional[List["VaultSecretGroup"]] = None, + allow_extension_operations: Optional[bool] = None, + require_guest_provision_signal: Optional[bool] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.WindowsConfiguration + :keyword linux_configuration: Specifies the Linux operating system settings on the virtual + machine. :code:`
`:code:`
`For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2022_03_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machine. To install certificates on a virtual machine it is recommended to use the `Azure Key + Vault virtual machine extension for Linux + `_ or the `Azure + Key Vault virtual machine extension for Windows + `_. + :paramtype secrets: list[~azure.mgmt.compute.v2022_03_01.models.VaultSecretGroup] + :keyword allow_extension_operations: Specifies whether extension operations should be allowed + on the virtual machine. :code:`
`:code:`
`This may only be set to False when no + extensions are present on the virtual machine. + :paramtype allow_extension_operations: bool + :keyword require_guest_provision_signal: Optional property which must either be set to True or + omitted. + :paramtype require_guest_provision_signal: bool + """ + super(OSProfile, self).__init__(**kwargs) + self.computer_name = computer_name + self.admin_username = admin_username + self.admin_password = admin_password + self.custom_data = custom_data + self.windows_configuration = windows_configuration + self.linux_configuration = linux_configuration + self.secrets = secrets + self.allow_extension_operations = allow_extension_operations + self.require_guest_provision_signal = require_guest_provision_signal + + +class 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.v2022_03_01.models.PatchInstallationState + """ + + _validation = { + 'patch_id': {'readonly': True}, + 'name': {'readonly': True}, + 'version': {'readonly': True}, + 'kb_id': {'readonly': True}, + 'classifications': {'readonly': True}, + 'installation_state': {'readonly': True}, + } + + _attribute_map = { + 'patch_id': {'key': 'patchId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'kb_id': {'key': 'kbId', 'type': 'str'}, + 'classifications': {'key': 'classifications', 'type': '[str]'}, + 'installation_state': {'key': 'installationState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(PatchInstallationDetail, self).__init__(**kwargs) + self.patch_id = None + self.name = None + self.version = None + self.kb_id = None + self.classifications = None + self.installation_state = None + + +class PatchSettings(msrest.serialization.Model): + """Specifies settings related to VM Guest Patching on Windows. + + :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 + 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". + :vartype patch_mode: str or ~azure.mgmt.compute.v2022_03_01.models.WindowsVMGuestPatchMode + :ivar enable_hotpatching: Enables customers to patch their Azure VMs without requiring a + reboot. For enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must + be set to 'AutomaticByPlatform'. + :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". + :vartype assessment_mode: str or + ~azure.mgmt.compute.v2022_03_01.models.WindowsPatchAssessmentMode + :ivar automatic_by_platform_settings: Specifies additional settings for patch mode + AutomaticByPlatform in VM Guest Patching on Windows. + :vartype automatic_by_platform_settings: + ~azure.mgmt.compute.v2022_03_01.models.WindowsVMGuestPatchAutomaticByPlatformSettings + """ + + _attribute_map = { + 'patch_mode': {'key': 'patchMode', 'type': 'str'}, + 'enable_hotpatching': {'key': 'enableHotpatching', 'type': 'bool'}, + 'assessment_mode': {'key': 'assessmentMode', 'type': 'str'}, + 'automatic_by_platform_settings': {'key': 'automaticByPlatformSettings', 'type': 'WindowsVMGuestPatchAutomaticByPlatformSettings'}, + } + + def __init__( + self, + *, + patch_mode: Optional[Union[str, "WindowsVMGuestPatchMode"]] = None, + enable_hotpatching: Optional[bool] = None, + assessment_mode: Optional[Union[str, "WindowsPatchAssessmentMode"]] = None, + automatic_by_platform_settings: Optional["WindowsVMGuestPatchAutomaticByPlatformSettings"] = 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.v2022_03_01.models.WindowsVMGuestPatchMode + :keyword enable_hotpatching: Enables customers to patch their Azure VMs without requiring a + reboot. For enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must + be set to 'AutomaticByPlatform'. + :paramtype enable_hotpatching: bool + :keyword assessment_mode: Specifies the mode of VM Guest patch assessment for the IaaS virtual + machine.:code:`
`:code:`
` Possible values are::code:`
`:code:`
` + **ImageDefault** - You control the timing of patch assessments on a virtual machine.:code:`
`:code:`
` **AutomaticByPlatform** - The platform will trigger periodic patch + assessments. The property provisionVMAgent must be true. Possible values include: + "ImageDefault", "AutomaticByPlatform". + :paramtype assessment_mode: str or + ~azure.mgmt.compute.v2022_03_01.models.WindowsPatchAssessmentMode + :keyword automatic_by_platform_settings: Specifies additional settings for patch mode + AutomaticByPlatform in VM Guest Patching on Windows. + :paramtype automatic_by_platform_settings: + ~azure.mgmt.compute.v2022_03_01.models.WindowsVMGuestPatchAutomaticByPlatformSettings + """ + super(PatchSettings, self).__init__(**kwargs) + self.patch_mode = patch_mode + self.enable_hotpatching = enable_hotpatching + self.assessment_mode = assessment_mode + self.automatic_by_platform_settings = automatic_by_platform_settings + + +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**. + + :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. + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + **kwargs + ): + """ + :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 + self.product = product + self.promotion_code = promotion_code + + +class ProximityPlacementGroup(Resource): + """Specifies information about the proximity placement group. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar zones: Specifies the Availability Zone where virtual machine, virtual machine scale set + or availability set associated with the proximity placement group can be created. + :vartype zones: list[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". + :vartype proximity_placement_group_type: str or + ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroupType + :ivar virtual_machines: A list of references to all virtual machines in the proximity placement + group. + :vartype virtual_machines: + list[~azure.mgmt.compute.v2022_03_01.models.SubResourceWithColocationStatus] + :ivar virtual_machine_scale_sets: A list of references to all virtual machine scale sets in the + proximity placement group. + :vartype virtual_machine_scale_sets: + list[~azure.mgmt.compute.v2022_03_01.models.SubResourceWithColocationStatus] + :ivar availability_sets: A list of references to all availability sets in the proximity + placement group. + :vartype availability_sets: + list[~azure.mgmt.compute.v2022_03_01.models.SubResourceWithColocationStatus] + :ivar colocation_status: Describes colocation status of the Proximity Placement Group. + :vartype colocation_status: ~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus + :ivar intent: Specifies the user intent of the proximity placement group. + :vartype intent: ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroupPropertiesIntent + """ + + _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}'}, + 'zones': {'key': 'zones', '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'}, + 'intent': {'key': 'properties.intent', 'type': 'ProximityPlacementGroupPropertiesIntent'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, + proximity_placement_group_type: Optional[Union[str, "ProximityPlacementGroupType"]] = None, + colocation_status: Optional["InstanceViewStatus"] = None, + intent: Optional["ProximityPlacementGroupPropertiesIntent"] = 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: Specifies the Availability Zone where virtual machine, virtual machine scale + set or availability set associated with the proximity placement group can be created. + :paramtype zones: list[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.v2022_03_01.models.ProximityPlacementGroupType + :keyword colocation_status: Describes colocation status of the Proximity Placement Group. + :paramtype colocation_status: ~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus + :keyword intent: Specifies the user intent of the proximity placement group. + :paramtype intent: + ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroupPropertiesIntent + """ + super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) + self.zones = zones + self.proximity_placement_group_type = proximity_placement_group_type + self.virtual_machines = None + self.virtual_machine_scale_sets = None + self.availability_sets = None + self.colocation_status = colocation_status + self.intent = intent + + +class ProximityPlacementGroupListResult(msrest.serialization.Model): + """The List Proximity Placement Group operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of proximity placement groups. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroup] + :ivar next_link: The URI to fetch the next page of proximity placement groups. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProximityPlacementGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ProximityPlacementGroup"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of proximity placement groups. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroup] + :keyword next_link: The URI to fetch the next page of proximity placement groups. + :paramtype next_link: str + """ + super(ProximityPlacementGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ProximityPlacementGroupPropertiesIntent(msrest.serialization.Model): + """Specifies the user intent of the proximity placement group. + + :ivar vm_sizes: Specifies possible sizes of virtual machines that can be created in the + proximity placement group. + :vartype vm_sizes: list[str] + """ + + _attribute_map = { + 'vm_sizes': {'key': 'vmSizes', 'type': '[str]'}, + } + + def __init__( + self, + *, + vm_sizes: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword vm_sizes: Specifies possible sizes of virtual machines that can be created in the + proximity placement group. + :paramtype vm_sizes: list[str] + """ + super(ProximityPlacementGroupPropertiesIntent, self).__init__(**kwargs) + self.vm_sizes = vm_sizes + + +class ProximityPlacementGroupUpdate(UpdateResource): + """Specifies information about the proximity placement group. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **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. It can only be set with OrchestrationMode as Flexible. + + :ivar name: Specify public IP sku name. Possible values include: "Basic", "Standard". + :vartype name: str or ~azure.mgmt.compute.v2022_03_01.models.PublicIPAddressSkuName + :ivar tier: Specify public IP sku tier. Possible values include: "Regional", "Global". + :vartype tier: str or ~azure.mgmt.compute.v2022_03_01.models.PublicIPAddressSkuTier + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "PublicIPAddressSkuName"]] = None, + 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.v2022_03_01.models.PublicIPAddressSkuName + :keyword tier: Specify public IP sku tier. Possible values include: "Regional", "Global". + :paramtype tier: str or ~azure.mgmt.compute.v2022_03_01.models.PublicIPAddressSkuTier + """ + super(PublicIPAddressSku, self).__init__(**kwargs) + self.name = name + self.tier = tier + + +class PurchasePlan(msrest.serialization.Model): + """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + + All required parameters must be populated in order to send to Azure. + + :ivar 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. + :vartype product: str + """ + + _validation = { + 'publisher': {'required': True}, + 'name': {'required': True}, + 'product': {'required': True}, + } + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher: str, + name: str, + product: str, + **kwargs + ): + """ + :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 + self.product = product + + +class RecoveryWalkResponse(msrest.serialization.Model): + """Response after calling a manual recovery walk. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar walk_performed: Whether the recovery walk was performed. + :vartype walk_performed: bool + :ivar next_platform_update_domain: The next update domain that needs to be walked. Null means + walk spanning all update domains has been completed. + :vartype next_platform_update_domain: int + """ + + _validation = { + 'walk_performed': {'readonly': True}, + 'next_platform_update_domain': {'readonly': True}, + } + + _attribute_map = { + 'walk_performed': {'key': 'walkPerformed', 'type': 'bool'}, + 'next_platform_update_domain': {'key': 'nextPlatformUpdateDomain', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(RecoveryWalkResponse, self).__init__(**kwargs) + self.walk_performed = None + self.next_platform_update_domain = None + + +class RequestRateByIntervalInput(LogAnalyticsInputBase): + """Api request input for LogAnalytics getRequestRateByInterval Api. + + All required parameters must be populated in order to send to Azure. + + :ivar blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :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". + :vartype interval_length: str or ~azure.mgmt.compute.v2022_03_01.models.IntervalInMins + """ + + _validation = { + 'blob_container_sas_uri': {'required': True}, + 'from_time': {'required': True}, + 'to_time': {'required': True}, + 'interval_length': {'required': True}, + } + + _attribute_map = { + 'blob_container_sas_uri': {'key': 'blobContainerSasUri', 'type': 'str'}, + 'from_time': {'key': 'fromTime', 'type': 'iso-8601'}, + 'to_time': {'key': 'toTime', 'type': 'iso-8601'}, + 'group_by_throttle_policy': {'key': 'groupByThrottlePolicy', 'type': 'bool'}, + 'group_by_operation_name': {'key': 'groupByOperationName', 'type': 'bool'}, + 'group_by_resource_name': {'key': 'groupByResourceName', 'type': 'bool'}, + 'group_by_client_application_id': {'key': 'groupByClientApplicationId', 'type': 'bool'}, + 'group_by_user_agent': {'key': 'groupByUserAgent', 'type': 'bool'}, + 'interval_length': {'key': 'intervalLength', 'type': 'str'}, + } + + def __init__( + self, + *, + blob_container_sas_uri: str, + from_time: datetime.datetime, + to_time: datetime.datetime, + interval_length: Union[str, "IntervalInMins"], + group_by_throttle_policy: Optional[bool] = None, + group_by_operation_name: Optional[bool] = None, + group_by_resource_name: Optional[bool] = None, + group_by_client_application_id: Optional[bool] = None, + group_by_user_agent: Optional[bool] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.IntervalInMins + """ + super(RequestRateByIntervalInput, self).__init__(blob_container_sas_uri=blob_container_sas_uri, from_time=from_time, to_time=to_time, group_by_throttle_policy=group_by_throttle_policy, group_by_operation_name=group_by_operation_name, group_by_resource_name=group_by_resource_name, group_by_client_application_id=group_by_client_application_id, group_by_user_agent=group_by_user_agent, **kwargs) + self.interval_length = interval_length + + +class ResourceWithOptionalLocation(msrest.serialization.Model): + """The Resource model definition with location property as optional. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar location: Resource location. + :vartype location: str + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(ResourceWithOptionalLocation, self).__init__(**kwargs) + self.location = location + self.id = None + self.name = None + self.type = None + self.tags = tags + + +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 + :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. + :vartype exclude_disks: list[~azure.mgmt.compute.v2022_03_01.models.ApiEntityReference] + :ivar source_metadata: Gets the details of the VM captured at the time of the restore point + creation. + :vartype source_metadata: ~azure.mgmt.compute.v2022_03_01.models.RestorePointSourceMetadata + :ivar provisioning_state: Gets the provisioning state of the restore point. + :vartype provisioning_state: str + :ivar consistency_mode: ConsistencyMode of the RestorePoint. Can be specified in the input + while creating a restore point. For now, only CrashConsistent is accepted as a valid input. + Please refer to https://aka.ms/RestorePoints for more details. Possible values include: + "CrashConsistent", "FileSystemConsistent", "ApplicationConsistent". + :vartype consistency_mode: str or ~azure.mgmt.compute.v2022_03_01.models.ConsistencyModeTypes + :ivar time_created: Gets the creation time of the restore point. + :vartype time_created: ~datetime.datetime + :ivar source_restore_point: Resource Id of the source restore point from which a copy needs to + be created. + :vartype source_restore_point: ~azure.mgmt.compute.v2022_03_01.models.ApiEntityReference + :ivar instance_view: The restore point instance view. + :vartype instance_view: ~azure.mgmt.compute.v2022_03_01.models.RestorePointInstanceView + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'source_metadata': {'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'}, + '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'}, + 'source_restore_point': {'key': 'properties.sourceRestorePoint', 'type': 'ApiEntityReference'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'RestorePointInstanceView'}, + } + + def __init__( + self, + *, + exclude_disks: Optional[List["ApiEntityReference"]] = None, + consistency_mode: Optional[Union[str, "ConsistencyModeTypes"]] = None, + time_created: Optional[datetime.datetime] = None, + source_restore_point: Optional["ApiEntityReference"] = 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.v2022_03_01.models.ApiEntityReference] + :keyword consistency_mode: ConsistencyMode of the RestorePoint. Can be specified in the input + while creating a restore point. For now, only CrashConsistent is accepted as a valid input. + Please refer to https://aka.ms/RestorePoints for more details. Possible values include: + "CrashConsistent", "FileSystemConsistent", "ApplicationConsistent". + :paramtype consistency_mode: str or ~azure.mgmt.compute.v2022_03_01.models.ConsistencyModeTypes + :keyword time_created: Gets the creation time of the restore point. + :paramtype time_created: ~datetime.datetime + :keyword source_restore_point: Resource Id of the source restore point from which a copy needs + to be created. + :paramtype source_restore_point: ~azure.mgmt.compute.v2022_03_01.models.ApiEntityReference + """ + super(RestorePoint, self).__init__(**kwargs) + self.exclude_disks = exclude_disks + self.source_metadata = None + self.provisioning_state = None + self.consistency_mode = consistency_mode + self.time_created = time_created + self.source_restore_point = source_restore_point + self.instance_view = 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 + :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. + :vartype source: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollectionSourceProperties + :ivar provisioning_state: The provisioning state of the restore point collection. + :vartype provisioning_state: str + :ivar restore_point_collection_id: The unique id of the restore point collection. + :vartype restore_point_collection_id: str + :ivar restore_points: A list containing all restore points created under this restore point + collection. + :vartype restore_points: list[~azure.mgmt.compute.v2022_03_01.models.RestorePoint] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'restore_point_collection_id': {'readonly': True}, + 'restore_points': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'RestorePointCollectionSourceProperties'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'restore_point_collection_id': {'key': 'properties.restorePointCollectionId', 'type': 'str'}, + 'restore_points': {'key': 'properties.restorePoints', 'type': '[RestorePoint]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + 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.v2022_03_01.models.RestorePointCollectionSourceProperties + """ + super(RestorePointCollection, self).__init__(location=location, tags=tags, **kwargs) + self.source = source + 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. + + :ivar value: Gets the list of restore point collections. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.RestorePointCollection] + :ivar next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() + with this to fetch the next page of RestorePointCollections. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RestorePointCollection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["RestorePointCollection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Gets the list of restore point collections. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.RestorePointCollection] + :keyword next_link: The uri to fetch the next page of RestorePointCollections. Call ListNext() + with this to fetch the next page of RestorePointCollections. + :paramtype next_link: str + """ + super(RestorePointCollectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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 + :ivar id: Resource Id of the source resource used to create this restore point collection. + :vartype id: str + """ + + _validation = { + 'location': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + 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 + + +class RestorePointCollectionUpdate(UpdateResource): + """Update Restore Point collection parameters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The properties of the source resource that this restore point collection is + created from. + :vartype source: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollectionSourceProperties + :ivar provisioning_state: The provisioning state of the restore point collection. + :vartype provisioning_state: str + :ivar restore_point_collection_id: The unique id of the restore point collection. + :vartype restore_point_collection_id: str + :ivar restore_points: A list containing all restore points created under this restore point + collection. + :vartype restore_points: list[~azure.mgmt.compute.v2022_03_01.models.RestorePoint] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'restore_point_collection_id': {'readonly': True}, + 'restore_points': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'RestorePointCollectionSourceProperties'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'restore_point_collection_id': {'key': 'properties.restorePointCollectionId', 'type': 'str'}, + 'restore_points': {'key': 'properties.restorePoints', 'type': '[RestorePoint]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + 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.v2022_03_01.models.RestorePointCollectionSourceProperties + """ + super(RestorePointCollectionUpdate, self).__init__(tags=tags, **kwargs) + self.source = source + self.provisioning_state = None + self.restore_point_collection_id = None + self.restore_points = None + + +class RestorePointInstanceView(msrest.serialization.Model): + """The instance view of a restore point. + + :ivar disk_restore_points: The disk restore points information. + :vartype disk_restore_points: + list[~azure.mgmt.compute.v2022_03_01.models.DiskRestorePointInstanceView] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'disk_restore_points': {'key': 'diskRestorePoints', 'type': '[DiskRestorePointInstanceView]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + disk_restore_points: Optional[List["DiskRestorePointInstanceView"]] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + """ + :keyword disk_restore_points: The disk restore points information. + :paramtype disk_restore_points: + list[~azure.mgmt.compute.v2022_03_01.models.DiskRestorePointInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + super(RestorePointInstanceView, self).__init__(**kwargs) + self.disk_restore_points = disk_restore_points + self.statuses = statuses + + +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. + + :ivar hardware_profile: Gets the hardware profile. + :vartype hardware_profile: ~azure.mgmt.compute.v2022_03_01.models.HardwareProfile + :ivar storage_profile: Gets the storage profile. + :vartype storage_profile: + ~azure.mgmt.compute.v2022_03_01.models.RestorePointSourceVMStorageProfile + :ivar os_profile: Gets the OS profile. + :vartype os_profile: ~azure.mgmt.compute.v2022_03_01.models.OSProfile + :ivar diagnostics_profile: Gets the diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :ivar license_type: Gets the license type, which is for bring your own license scenario. + :vartype license_type: str + :ivar vm_id: Gets the virtual machine unique id. + :vartype vm_id: str + :ivar security_profile: Gets the security profile. + :vartype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :ivar location: Location of the VM from which the restore point was created. + :vartype 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, + *, + hardware_profile: Optional["HardwareProfile"] = None, + storage_profile: Optional["RestorePointSourceVMStorageProfile"] = None, + os_profile: Optional["OSProfile"] = None, + diagnostics_profile: Optional["DiagnosticsProfile"] = None, + license_type: Optional[str] = None, + vm_id: Optional[str] = None, + security_profile: Optional["SecurityProfile"] = None, + location: Optional[str] = None, + **kwargs + ): + """ + :keyword hardware_profile: Gets the hardware profile. + :paramtype hardware_profile: ~azure.mgmt.compute.v2022_03_01.models.HardwareProfile + :keyword storage_profile: Gets the storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2022_03_01.models.RestorePointSourceVMStorageProfile + :keyword os_profile: Gets the OS profile. + :paramtype os_profile: ~azure.mgmt.compute.v2022_03_01.models.OSProfile + :keyword diagnostics_profile: Gets the diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :keyword license_type: Gets the license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword vm_id: Gets the virtual machine unique id. + :paramtype vm_id: str + :keyword security_profile: Gets the security profile. + :paramtype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :keyword location: Location of the VM from which the restore point was created. + :paramtype location: str + """ + super(RestorePointSourceMetadata, self).__init__(**kwargs) + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.os_profile = os_profile + self.diagnostics_profile = diagnostics_profile + self.license_type = license_type + self.vm_id = vm_id + self.security_profile = security_profile + self.location = location + + +class RestorePointSourceVMDataDisk(msrest.serialization.Model): + """Describes a data disk. + + :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.v2022_03_01.models.CachingTypes + :ivar disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new desired + size for existing OS and Data disks. + :vartype disk_size_gb: int + :ivar managed_disk: Gets the managed disk details. + :vartype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.ManagedDiskParameters + :ivar disk_restore_point: Gets the disk restore point Id. + :vartype disk_restore_point: ~azure.mgmt.compute.v2022_03_01.models.ApiEntityReference + """ + + _attribute_map = { + 'lun': {'key': 'lun', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, + 'disk_restore_point': {'key': 'diskRestorePoint', 'type': 'ApiEntityReference'}, + } + + def __init__( + self, + *, + lun: Optional[int] = None, + name: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + disk_size_gb: Optional[int] = None, + managed_disk: Optional["ManagedDiskParameters"] = None, + 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.v2022_03_01.models.CachingTypes + :keyword disk_size_gb: Gets the initial disk size in GB for blank data disks, and the new + desired size for existing OS and Data disks. + :paramtype disk_size_gb: int + :keyword managed_disk: Gets the managed disk details. + :paramtype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.ManagedDiskParameters + :keyword disk_restore_point: Gets the disk restore point Id. + :paramtype disk_restore_point: ~azure.mgmt.compute.v2022_03_01.models.ApiEntityReference + """ + super(RestorePointSourceVMDataDisk, self).__init__(**kwargs) + self.lun = lun + self.name = name + self.caching = caching + self.disk_size_gb = disk_size_gb + self.managed_disk = managed_disk + self.disk_restore_point = disk_restore_point + + +class RestorePointSourceVMOSDisk(msrest.serialization.Model): + """Describes an Operating System disk. + + :ivar os_type: Gets the Operating System type. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemType + :ivar encryption_settings: Gets the disk encryption settings. + :vartype encryption_settings: ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSettings + :ivar name: Gets the disk name. + :vartype name: str + :ivar caching: Gets the caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :ivar disk_size_gb: Gets the disk size in GB. + :vartype disk_size_gb: int + :ivar managed_disk: Gets the managed disk details. + :vartype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.ManagedDiskParameters + :ivar disk_restore_point: Gets the disk restore point Id. + :vartype disk_restore_point: ~azure.mgmt.compute.v2022_03_01.models.ApiEntityReference + """ + + _attribute_map = { + 'os_type': {'key': 'osType', 'type': 'str'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': 'DiskEncryptionSettings'}, + 'name': {'key': 'name', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, + 'disk_restore_point': {'key': 'diskRestorePoint', 'type': 'ApiEntityReference'}, + } + + def __init__( + self, + *, + os_type: Optional[Union[str, "OperatingSystemType"]] = None, + encryption_settings: Optional["DiskEncryptionSettings"] = None, + name: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + disk_size_gb: Optional[int] = None, + managed_disk: Optional["ManagedDiskParameters"] = None, + 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.v2022_03_01.models.OperatingSystemType + :keyword encryption_settings: Gets the disk encryption settings. + :paramtype encryption_settings: ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSettings + :keyword name: Gets the disk name. + :paramtype name: str + :keyword caching: Gets the caching type. Possible values include: "None", "ReadOnly", + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :keyword disk_size_gb: Gets the disk size in GB. + :paramtype disk_size_gb: int + :keyword managed_disk: Gets the managed disk details. + :paramtype managed_disk: ~azure.mgmt.compute.v2022_03_01.models.ManagedDiskParameters + :keyword disk_restore_point: Gets the disk restore point Id. + :paramtype disk_restore_point: ~azure.mgmt.compute.v2022_03_01.models.ApiEntityReference + """ + super(RestorePointSourceVMOSDisk, self).__init__(**kwargs) + self.os_type = os_type + self.encryption_settings = encryption_settings + self.name = name + self.caching = caching + self.disk_size_gb = disk_size_gb + self.managed_disk = managed_disk + self.disk_restore_point = disk_restore_point + + +class RestorePointSourceVMStorageProfile(msrest.serialization.Model): + """Describes the storage profile. + + :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.v2022_03_01.models.RestorePointSourceVMOSDisk + :ivar data_disks: Gets the data disks of the VM captured at the time of the restore point + creation. + :vartype data_disks: list[~azure.mgmt.compute.v2022_03_01.models.RestorePointSourceVMDataDisk] + """ + + _attribute_map = { + 'os_disk': {'key': 'osDisk', 'type': 'RestorePointSourceVMOSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[RestorePointSourceVMDataDisk]'}, + } + + def __init__( + self, + *, + os_disk: Optional["RestorePointSourceVMOSDisk"] = None, + 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.v2022_03_01.models.RestorePointSourceVMOSDisk + :keyword data_disks: Gets the data disks of the VM captured at the time of the restore point + creation. + :paramtype data_disks: + list[~azure.mgmt.compute.v2022_03_01.models.RestorePointSourceVMDataDisk] + """ + super(RestorePointSourceVMStorageProfile, self).__init__(**kwargs) + self.os_disk = os_disk + self.data_disks = data_disks + + +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.v2022_03_01.models.ApiError + """ + + _validation = { + 'successfully_rolledback_instance_count': {'readonly': True}, + 'failed_rolledback_instance_count': {'readonly': True}, + 'rollback_error': {'readonly': True}, + } + + _attribute_map = { + 'successfully_rolledback_instance_count': {'key': 'successfullyRolledbackInstanceCount', 'type': 'int'}, + 'failed_rolledback_instance_count': {'key': 'failedRolledbackInstanceCount', 'type': 'int'}, + 'rollback_error': {'key': 'rollbackError', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(RollbackStatusInfo, self).__init__(**kwargs) + self.successfully_rolledback_instance_count = None + self.failed_rolledback_instance_count = None + self.rollback_error = None + + +class RollingUpgradePolicy(msrest.serialization.Model): + """The configuration parameters used while performing a rolling upgrade. + + :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%. + :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%. + :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%. + :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). + :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. + :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 = { + 'max_batch_instance_percent': {'maximum': 100, 'minimum': 5}, + 'max_unhealthy_instance_percent': {'maximum': 100, 'minimum': 5}, + 'max_unhealthy_upgraded_instance_percent': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'max_batch_instance_percent': {'key': 'maxBatchInstancePercent', 'type': 'int'}, + 'max_unhealthy_instance_percent': {'key': 'maxUnhealthyInstancePercent', 'type': 'int'}, + 'max_unhealthy_upgraded_instance_percent': {'key': 'maxUnhealthyUpgradedInstancePercent', 'type': 'int'}, + 'pause_time_between_batches': {'key': 'pauseTimeBetweenBatches', 'type': 'str'}, + 'enable_cross_zone_upgrade': {'key': 'enableCrossZoneUpgrade', 'type': 'bool'}, + 'prioritize_unhealthy_instances': {'key': 'prioritizeUnhealthyInstances', 'type': 'bool'}, + } + + def __init__( + self, + *, + max_batch_instance_percent: Optional[int] = None, + max_unhealthy_instance_percent: Optional[int] = None, + max_unhealthy_upgraded_instance_percent: Optional[int] = None, + pause_time_between_batches: Optional[str] = None, + enable_cross_zone_upgrade: Optional[bool] = None, + prioritize_unhealthy_instances: Optional[bool] = None, + **kwargs + ): + """ + :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 + self.max_unhealthy_upgraded_instance_percent = max_unhealthy_upgraded_instance_percent + self.pause_time_between_batches = pause_time_between_batches + self.enable_cross_zone_upgrade = enable_cross_zone_upgrade + self.prioritize_unhealthy_instances = prioritize_unhealthy_instances + + +class RollingUpgradeProgressInfo(msrest.serialization.Model): + """Information about the number of virtual machine instances in each upgrade state. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successful_instance_count: The number of instances that have been successfully upgraded. + :vartype successful_instance_count: int + :ivar failed_instance_count: The number of instances that have failed to be upgraded + successfully. + :vartype failed_instance_count: int + :ivar in_progress_instance_count: The number of instances that are currently being upgraded. + :vartype in_progress_instance_count: int + :ivar pending_instance_count: The number of instances that have not yet begun to be upgraded. + :vartype pending_instance_count: int + """ + + _validation = { + 'successful_instance_count': {'readonly': True}, + 'failed_instance_count': {'readonly': True}, + 'in_progress_instance_count': {'readonly': True}, + 'pending_instance_count': {'readonly': True}, + } + + _attribute_map = { + 'successful_instance_count': {'key': 'successfulInstanceCount', 'type': 'int'}, + 'failed_instance_count': {'key': 'failedInstanceCount', 'type': 'int'}, + 'in_progress_instance_count': {'key': 'inProgressInstanceCount', 'type': 'int'}, + 'pending_instance_count': {'key': 'pendingInstanceCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(RollingUpgradeProgressInfo, self).__init__(**kwargs) + self.successful_instance_count = None + self.failed_instance_count = None + self.in_progress_instance_count = None + self.pending_instance_count = None + + +class RollingUpgradeRunningStatus(msrest.serialization.Model): + """Information about the current running state of the overall upgrade. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Code indicating the current status of the upgrade. Possible values include: + "RollingForward", "Cancelled", "Completed", "Faulted". + :vartype code: str or ~azure.mgmt.compute.v2022_03_01.models.RollingUpgradeStatusCode + :ivar start_time: Start time of the upgrade. + :vartype start_time: ~datetime.datetime + :ivar last_action: The last action performed on the rolling upgrade. Possible values include: + "Start", "Cancel". + :vartype last_action: str or ~azure.mgmt.compute.v2022_03_01.models.RollingUpgradeActionType + :ivar last_action_time: Last action time of the upgrade. + :vartype last_action_time: ~datetime.datetime + """ + + _validation = { + 'code': {'readonly': True}, + 'start_time': {'readonly': True}, + 'last_action': {'readonly': True}, + 'last_action_time': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'last_action': {'key': 'lastAction', 'type': 'str'}, + 'last_action_time': {'key': 'lastActionTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(RollingUpgradeRunningStatus, self).__init__(**kwargs) + self.code = None + self.start_time = None + self.last_action = None + self.last_action_time = None + + +class RollingUpgradeStatusInfo(Resource): + """The status of the latest virtual machine scale set rolling upgrade. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :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.v2022_03_01.models.RollingUpgradePolicy + :ivar running_status: Information about the current running state of the overall upgrade. + :vartype running_status: ~azure.mgmt.compute.v2022_03_01.models.RollingUpgradeRunningStatus + :ivar progress: Information about the number of virtual machine instances in each upgrade + state. + :vartype progress: ~azure.mgmt.compute.v2022_03_01.models.RollingUpgradeProgressInfo + :ivar error: Error details for this upgrade, if there are any. + :vartype error: ~azure.mgmt.compute.v2022_03_01.models.ApiError + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'policy': {'readonly': True}, + 'running_status': {'readonly': True}, + 'progress': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'policy': {'key': 'properties.policy', 'type': 'RollingUpgradePolicy'}, + 'running_status': {'key': 'properties.runningStatus', 'type': 'RollingUpgradeRunningStatus'}, + 'progress': {'key': 'properties.progress', 'type': 'RollingUpgradeProgressInfo'}, + 'error': {'key': 'properties.error', 'type': 'ApiError'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :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 + 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. + + :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". + :vartype os_type: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + """ + + _validation = { + 'schema': {'required': True}, + 'id': {'required': True}, + 'os_type': {'required': True}, + 'label': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'schema': {'key': '$schema', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + schema: str, + id: str, + os_type: Union[str, "OperatingSystemTypes"], + label: str, + description: str, + **kwargs + ): + """ + :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.v2022_03_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + """ + super(RunCommandDocumentBase, self).__init__(**kwargs) + self.schema = schema + self.id = id + self.os_type = os_type + self.label = label + self.description = description + + +class RunCommandDocument(RunCommandDocumentBase): + """Describes the properties of a Run Command. + + All required parameters must be populated in order to send to Azure. + + :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". + :vartype os_type: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemTypes + :ivar label: Required. The VM run command label. + :vartype label: str + :ivar description: Required. The VM run command description. + :vartype description: str + :ivar script: Required. The script to be executed. + :vartype script: list[str] + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2022_03_01.models.RunCommandParameterDefinition] + """ + + _validation = { + 'schema': {'required': True}, + 'id': {'required': True}, + 'os_type': {'required': True}, + 'label': {'required': True}, + 'description': {'required': True}, + 'script': {'required': True}, + } + + _attribute_map = { + 'schema': {'key': '$schema', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'script': {'key': 'script', 'type': '[str]'}, + 'parameters': {'key': 'parameters', 'type': '[RunCommandParameterDefinition]'}, + } + + def __init__( + self, + *, + schema: str, + id: str, + os_type: Union[str, "OperatingSystemTypes"], + label: str, + description: str, + script: List[str], + parameters: Optional[List["RunCommandParameterDefinition"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.OperatingSystemTypes + :keyword label: Required. The VM run command label. + :paramtype label: str + :keyword description: Required. The VM run command description. + :paramtype description: str + :keyword script: Required. The script to be executed. + :paramtype script: list[str] + :keyword parameters: The parameters used by the script. + :paramtype parameters: + list[~azure.mgmt.compute.v2022_03_01.models.RunCommandParameterDefinition] + """ + super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) + self.script = script + self.parameters = parameters + + +class RunCommandInput(msrest.serialization.Model): + """Capture Virtual Machine parameters. + + All required parameters must be populated in order to send to Azure. + + :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. + :vartype script: list[str] + :ivar parameters: The run command parameters. + :vartype parameters: list[~azure.mgmt.compute.v2022_03_01.models.RunCommandInputParameter] + """ + + _validation = { + 'command_id': {'required': True}, + } + + _attribute_map = { + 'command_id': {'key': 'commandId', 'type': 'str'}, + 'script': {'key': 'script', 'type': '[str]'}, + 'parameters': {'key': 'parameters', 'type': '[RunCommandInputParameter]'}, + } + + def __init__( + self, + *, + command_id: str, + script: Optional[List[str]] = None, + parameters: Optional[List["RunCommandInputParameter"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.RunCommandInputParameter] + """ + super(RunCommandInput, self).__init__(**kwargs) + self.command_id = command_id + self.script = script + self.parameters = parameters + + +class RunCommandInputParameter(msrest.serialization.Model): + """Describes the properties of a run command parameter. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The run command parameter name. + :vartype name: str + :ivar value: Required. The run command parameter value. + :vartype value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + value: str, + **kwargs + ): + """ + :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 + + +class RunCommandListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of virtual machine run commands. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.RunCommandDocumentBase] + :ivar next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + fetch the next page of run commands. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RunCommandDocumentBase]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["RunCommandDocumentBase"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of virtual machine run commands. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.RunCommandDocumentBase] + :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this + to fetch the next page of run commands. + :paramtype next_link: str + """ + super(RunCommandListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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. + + :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 = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_value': {'key': 'defaultValue', 'type': 'str'}, + 'required': {'key': 'required', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + type: str, + default_value: Optional[str] = None, + required: Optional[bool] = False, + **kwargs + ): + """ + :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 + self.default_value = default_value + self.required = required + + +class RunCommandResult(msrest.serialization.Model): + """RunCommandResult. + + :ivar value: Run command operation response. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + value: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + """ + :keyword value: Run command operation response. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + super(RunCommandResult, self).__init__(**kwargs) + self.value = value + + +class ScaleInPolicy(msrest.serialization.Model): + """Describes a scale-in policy for 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 + 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:`
`. + :vartype rules: list[str or + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetScaleInRules] + :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). + :vartype force_deletion: bool + """ + + _attribute_map = { + 'rules': {'key': 'rules', 'type': '[str]'}, + 'force_deletion': {'key': 'forceDeletion', 'type': 'bool'}, + } + + def __init__( + self, + *, + rules: Optional[List[Union[str, "VirtualMachineScaleSetScaleInRules"]]] = None, + 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.v2022_03_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 + + +class ScheduledEventsProfile(msrest.serialization.Model): + """ScheduledEventsProfile. + + :ivar terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :vartype terminate_notification_profile: + ~azure.mgmt.compute.v2022_03_01.models.TerminateNotificationProfile + """ + + _attribute_map = { + 'terminate_notification_profile': {'key': 'terminateNotificationProfile', 'type': 'TerminateNotificationProfile'}, + } + + def __init__( + self, + *, + terminate_notification_profile: Optional["TerminateNotificationProfile"] = None, + **kwargs + ): + """ + :keyword terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :paramtype terminate_notification_profile: + ~azure.mgmt.compute.v2022_03_01.models.TerminateNotificationProfile + """ + super(ScheduledEventsProfile, self).__init__(**kwargs) + self.terminate_notification_profile = terminate_notification_profile + + +class SecurityProfile(msrest.serialization.Model): + """Specifies the Security profile settings for the virtual machine or virtual machine scale set. + + :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. + :vartype uefi_settings: ~azure.mgmt.compute.v2022_03_01.models.UefiSettings + :ivar encryption_at_host: This property can be used by user in the request to enable or disable + the Host Encryption for the virtual machine or virtual machine scale set. This will enable the + encryption for all the disks including Resource/Temp disk at host itself. + :code:`
`:code:`
` Default: The Encryption at host will be disabled unless this property + is set to true for the resource. + :vartype encryption_at_host: bool + :ivar security_type: Specifies the SecurityType of the virtual machine. It has to be set to any + specified value to enable UefiSettings. :code:`
`:code:`
` Default: UefiSettings will not + be enabled unless this property is set. Possible values include: "TrustedLaunch", + "ConfidentialVM". + :vartype security_type: str or ~azure.mgmt.compute.v2022_03_01.models.SecurityTypes + """ + + _attribute_map = { + 'uefi_settings': {'key': 'uefiSettings', 'type': 'UefiSettings'}, + 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'bool'}, + 'security_type': {'key': 'securityType', 'type': 'str'}, + } + + def __init__( + self, + *, + uefi_settings: Optional["UefiSettings"] = None, + encryption_at_host: Optional[bool] = None, + 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.v2022_03_01.models.UefiSettings + :keyword encryption_at_host: This property can be used by user in the request to enable or + disable the Host Encryption for the virtual machine or virtual machine scale set. This will + enable the encryption for all the disks including Resource/Temp disk at host itself. + :code:`
`:code:`
` Default: The Encryption at host will be disabled unless this property + is set to true for the resource. + :paramtype encryption_at_host: bool + :keyword security_type: Specifies the SecurityType of the virtual machine. It has to be set to + any specified value to enable UefiSettings. :code:`
`:code:`
` Default: UefiSettings will + not be enabled unless this property is set. Possible values include: "TrustedLaunch", + "ConfidentialVM". + :paramtype security_type: str or ~azure.mgmt.compute.v2022_03_01.models.SecurityTypes + """ + super(SecurityProfile, self).__init__(**kwargs) + self.uefi_settings = uefi_settings + self.encryption_at_host = encryption_at_host + self.security_type = security_type + + +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. + + :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**. + :vartype tier: str + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: long + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + """ + :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 + self.capacity = capacity + + +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. + + :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. + :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. + :vartype restore_timeout: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'restore_timeout': {'key': 'restoreTimeout', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + 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 + + +class SshConfiguration(msrest.serialization.Model): + """SSH configuration for Linux based VMs running on Azure. + + :ivar public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :vartype public_keys: list[~azure.mgmt.compute.v2022_03_01.models.SshPublicKey] + """ + + _attribute_map = { + 'public_keys': {'key': 'publicKeys', 'type': '[SshPublicKey]'}, + } + + def __init__( + self, + *, + 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.v2022_03_01.models.SshPublicKey] + """ + super(SshConfiguration, self).__init__(**kwargs) + self.public_keys = public_keys + + +class SshPublicKey(msrest.serialization.Model): + """Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + + :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. + :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). + :vartype key_data: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'key_data': {'key': 'keyData', 'type': 'str'}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + key_data: Optional[str] = None, + **kwargs + ): + """ + :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 + + +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. + + :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. + :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. + :vartype public_key: str + :ivar id: Required. The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + :vartype id: str + """ + + _validation = { + 'private_key': {'required': True}, + 'public_key': {'required': True}, + 'id': {'required': True}, + } + + _attribute_map = { + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'public_key': {'key': 'publicKey', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + private_key: str, + public_key: str, + id: str, + **kwargs + ): + """ + :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 + self.id = id + + +class SshPublicKeyResource(Resource): + """Specifies information about the SSH public key. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :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 = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'public_key': {'key': 'properties.publicKey', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + public_key: Optional[str] = None, + **kwargs + ): + """ + :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 + + +class SshPublicKeysGroupListResult(msrest.serialization.Model): + """The list SSH public keys operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of SSH public keys. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyResource] + :ivar next_link: The URI to fetch the next page of SSH public keys. Call ListNext() with this + URI to fetch the next page of SSH public keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SshPublicKeyResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SshPublicKeyResource"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of SSH public keys. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyResource] + :keyword next_link: The URI to fetch the next page of SSH public keys. Call ListNext() with + this URI to fetch the next page of SSH public keys. + :paramtype next_link: str + """ + super(SshPublicKeysGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SshPublicKeyUpdateResource(UpdateResource): + """Specifies information about the SSH public key. + + :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 = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'public_key': {'key': 'properties.publicKey', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + public_key: Optional[str] = None, + **kwargs + ): + """ + :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 + + +class StorageProfile(msrest.serialization.Model): + """Specifies the storage settings for the virtual machine disks. + + :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. + :vartype image_reference: ~azure.mgmt.compute.v2022_03_01.models.ImageReference + :ivar os_disk: Specifies information about the operating system disk used by the virtual + machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs + for Azure virtual machines + `_. + :vartype os_disk: ~azure.mgmt.compute.v2022_03_01.models.OSDisk + :ivar data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs + for Azure virtual machines + `_. + :vartype data_disks: list[~azure.mgmt.compute.v2022_03_01.models.DataDisk] + """ + + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'OSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[DataDisk]'}, + } + + def __init__( + self, + *, + image_reference: Optional["ImageReference"] = None, + os_disk: Optional["OSDisk"] = None, + data_disks: Optional[List["DataDisk"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.ImageReference + :keyword os_disk: Specifies information about the operating system disk used by the virtual + machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs + for Azure virtual machines + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2022_03_01.models.OSDisk + :keyword data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs + for Azure virtual machines + `_. + :paramtype data_disks: list[~azure.mgmt.compute.v2022_03_01.models.DataDisk] + """ + super(StorageProfile, self).__init__(**kwargs) + self.image_reference = image_reference + self.os_disk = os_disk + self.data_disks = data_disks + + +class SubResourceReadOnly(msrest.serialization.Model): + """SubResourceReadOnly. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SubResourceReadOnly, self).__init__(**kwargs) + self.id = None + + +class SubResourceWithColocationStatus(SubResource): + """SubResourceWithColocationStatus. + + :ivar id: Resource Id. + :vartype id: str + :ivar colocation_status: Describes colocation status of a resource in the Proximity Placement + Group. + :vartype colocation_status: ~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'colocation_status': {'key': 'colocationStatus', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + colocation_status: Optional["InstanceViewStatus"] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.InstanceViewStatus + """ + super(SubResourceWithColocationStatus, self).__init__(id=id, **kwargs) + self.colocation_status = colocation_status + + +class TerminateNotificationProfile(msrest.serialization.Model): + """TerminateNotificationProfile. + + :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 = { + 'not_before_timeout': {'key': 'notBeforeTimeout', 'type': 'str'}, + 'enable': {'key': 'enable', 'type': 'bool'}, + } + + def __init__( + self, + *, + not_before_timeout: Optional[str] = None, + enable: Optional[bool] = None, + **kwargs + ): + """ + :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 + + +class ThrottledRequestsInput(LogAnalyticsInputBase): + """Api request input for LogAnalytics getThrottledRequests Api. + + All required parameters must be populated in order to send to Azure. + + :ivar blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :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 = { + 'blob_container_sas_uri': {'required': True}, + 'from_time': {'required': True}, + 'to_time': {'required': True}, + } + + _attribute_map = { + 'blob_container_sas_uri': {'key': 'blobContainerSasUri', 'type': 'str'}, + 'from_time': {'key': 'fromTime', 'type': 'iso-8601'}, + 'to_time': {'key': 'toTime', 'type': 'iso-8601'}, + 'group_by_throttle_policy': {'key': 'groupByThrottlePolicy', 'type': 'bool'}, + 'group_by_operation_name': {'key': 'groupByOperationName', 'type': 'bool'}, + 'group_by_resource_name': {'key': 'groupByResourceName', 'type': 'bool'}, + 'group_by_client_application_id': {'key': 'groupByClientApplicationId', 'type': 'bool'}, + 'group_by_user_agent': {'key': 'groupByUserAgent', 'type': 'bool'}, + } + + def __init__( + self, + *, + blob_container_sas_uri: str, + from_time: datetime.datetime, + to_time: datetime.datetime, + group_by_throttle_policy: Optional[bool] = None, + group_by_operation_name: Optional[bool] = None, + group_by_resource_name: Optional[bool] = None, + group_by_client_application_id: Optional[bool] = None, + group_by_user_agent: Optional[bool] = None, + **kwargs + ): + """ + :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. + + :ivar secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual + machine. :code:`
`:code:`
`Minimum api-version: 2020-12-01. + :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. + :vartype v_tpm_enabled: bool + """ + + _attribute_map = { + 'secure_boot_enabled': {'key': 'secureBootEnabled', 'type': 'bool'}, + 'v_tpm_enabled': {'key': 'vTpmEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + secure_boot_enabled: Optional[bool] = None, + v_tpm_enabled: Optional[bool] = None, + **kwargs + ): + """ + :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 + + +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.v2022_03_01.models.UpgradeOperationHistoricalStatusInfoProperties + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + """ + + _validation = { + 'properties': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'UpgradeOperationHistoricalStatusInfoProperties'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) + self.properties = None + self.type = None + self.location = None + + +class UpgradeOperationHistoricalStatusInfoProperties(msrest.serialization.Model): + """Describes each OS upgrade on the Virtual Machine Scale Set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar running_status: Information about the overall status of the upgrade operation. + :vartype running_status: ~azure.mgmt.compute.v2022_03_01.models.UpgradeOperationHistoryStatus + :ivar progress: Counts of the VMs in each state. + :vartype progress: ~azure.mgmt.compute.v2022_03_01.models.RollingUpgradeProgressInfo + :ivar error: Error Details for this upgrade if there are any. + :vartype error: ~azure.mgmt.compute.v2022_03_01.models.ApiError + :ivar started_by: Invoker of the Upgrade Operation. Possible values include: "Unknown", "User", + "Platform". + :vartype started_by: str or ~azure.mgmt.compute.v2022_03_01.models.UpgradeOperationInvoker + :ivar target_image_reference: Image Reference details. + :vartype target_image_reference: ~azure.mgmt.compute.v2022_03_01.models.ImageReference + :ivar rollback_info: Information about OS rollback if performed. + :vartype rollback_info: ~azure.mgmt.compute.v2022_03_01.models.RollbackStatusInfo + """ + + _validation = { + 'running_status': {'readonly': True}, + 'progress': {'readonly': True}, + 'error': {'readonly': True}, + 'started_by': {'readonly': True}, + 'target_image_reference': {'readonly': True}, + 'rollback_info': {'readonly': True}, + } + + _attribute_map = { + 'running_status': {'key': 'runningStatus', 'type': 'UpgradeOperationHistoryStatus'}, + 'progress': {'key': 'progress', 'type': 'RollingUpgradeProgressInfo'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + 'started_by': {'key': 'startedBy', 'type': 'str'}, + 'target_image_reference': {'key': 'targetImageReference', 'type': 'ImageReference'}, + 'rollback_info': {'key': 'rollbackInfo', 'type': 'RollbackStatusInfo'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) + self.running_status = None + self.progress = None + self.error = None + self.started_by = None + self.target_image_reference = None + self.rollback_info = None + + +class UpgradeOperationHistoryStatus(msrest.serialization.Model): + """Information about the current running state of the overall upgrade. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Code indicating the current status of the upgrade. Possible values include: + "RollingForward", "Cancelled", "Completed", "Faulted". + :vartype code: str or ~azure.mgmt.compute.v2022_03_01.models.UpgradeState + :ivar start_time: Start time of the upgrade. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of the upgrade. + :vartype end_time: ~datetime.datetime + """ + + _validation = { + 'code': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) + self.code = None + self.start_time = None + self.end_time = None + + +class UpgradePolicy(msrest.serialization.Model): + """Describes an upgrade policy - automatic, manual, or rolling. + + :ivar 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". + :vartype mode: str or ~azure.mgmt.compute.v2022_03_01.models.UpgradeMode + :ivar rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :vartype rolling_upgrade_policy: ~azure.mgmt.compute.v2022_03_01.models.RollingUpgradePolicy + :ivar automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :vartype automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2022_03_01.models.AutomaticOSUpgradePolicy + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'rolling_upgrade_policy': {'key': 'rollingUpgradePolicy', 'type': 'RollingUpgradePolicy'}, + 'automatic_os_upgrade_policy': {'key': 'automaticOSUpgradePolicy', 'type': 'AutomaticOSUpgradePolicy'}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "UpgradeMode"]] = None, + rolling_upgrade_policy: Optional["RollingUpgradePolicy"] = None, + automatic_os_upgrade_policy: Optional["AutomaticOSUpgradePolicy"] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.UpgradeMode + :keyword rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :paramtype rolling_upgrade_policy: ~azure.mgmt.compute.v2022_03_01.models.RollingUpgradePolicy + :keyword automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :paramtype automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2022_03_01.models.AutomaticOSUpgradePolicy + """ + super(UpgradePolicy, self).__init__(**kwargs) + self.mode = mode + self.rolling_upgrade_policy = rolling_upgrade_policy + self.automatic_os_upgrade_policy = automatic_os_upgrade_policy + + +class Usage(msrest.serialization.Model): + """Describes Compute Resource Usage. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar unit: An enum describing the unit of usage measurement. Has constant value: "Count". + :vartype unit: str + :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.v2022_03_01.models.UsageName + """ + + _validation = { + 'unit': {'required': True, 'constant': True}, + 'current_value': {'required': True}, + 'limit': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'name': {'key': 'name', 'type': 'UsageName'}, + } + + unit = "Count" + + def __init__( + self, + *, + current_value: int, + limit: int, + name: "UsageName", + **kwargs + ): + """ + :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.v2022_03_01.models.UsageName + """ + super(Usage, self).__init__(**kwargs) + self.current_value = current_value + self.limit = limit + self.name = name + + +class UsageName(msrest.serialization.Model): + """The Usage Names. + + :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 = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + 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 + + +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. + + :ivar certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + a secret. For adding a secret to the Key Vault, see `Add a key or secret to the key vault + `_. In this case, your + certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded + in UTF-8: :code:`
`:code:`
` {:code:`
` + "data":":code:``",:code:`
` "dataType":"pfx",:code:`
` + "password":":code:``":code:`
`} :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 + `_. + :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. + :vartype certificate_store: str + """ + + _attribute_map = { + 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, + 'certificate_store': {'key': 'certificateStore', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate_url: Optional[str] = None, + certificate_store: Optional[str] = None, + **kwargs + ): + """ + :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 + + +class VaultSecretGroup(msrest.serialization.Model): + """Describes a set of certificates which are all in the same Key Vault. + + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :vartype source_vault: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :vartype vault_certificates: list[~azure.mgmt.compute.v2022_03_01.models.VaultCertificate] + """ + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + 'vault_certificates': {'key': 'vaultCertificates', 'type': '[VaultCertificate]'}, + } + + def __init__( + self, + *, + source_vault: Optional["SubResource"] = None, + vault_certificates: Optional[List["VaultCertificate"]] = None, + **kwargs + ): + """ + :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :paramtype source_vault: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :paramtype vault_certificates: list[~azure.mgmt.compute.v2022_03_01.models.VaultCertificate] + """ + super(VaultSecretGroup, self).__init__(**kwargs) + self.source_vault = source_vault + self.vault_certificates = vault_certificates + + +class VirtualHardDisk(msrest.serialization.Model): + """Describes the uri of a disk. + + :ivar uri: Specifies the virtual hard disk's uri. + :vartype uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + *, + 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 + + +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 + :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**. + :vartype plan: ~azure.mgmt.compute.v2022_03_01.models.Plan + :ivar resources: The virtual machine child extension resources. + :vartype resources: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtension] + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2022_03_01.models.ExtendedLocation + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2022_03_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2022_03_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :vartype additional_capabilities: ~azure.mgmt.compute.v2022_03_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :vartype os_profile: ~azure.mgmt.compute.v2022_03_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2022_03_01.models.NetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual + machine. + :vartype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
`:code:`
`Minimum api-version: 2015-06-15. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :ivar availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Availability sets overview + `_. + :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. + :vartype availability_set: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar virtual_machine_scale_set: Specifies information about the virtual machine scale set that + the virtual machine should be assigned to. Virtual machines specified in the same virtual + machine scale set are allocated to different nodes to maximize availability. Currently, a VM + can only be added to virtual machine scale set at creation time. An existing VM cannot be added + to a virtual machine scale set. :code:`
`:code:`
`This property cannot exist along with a + non-null properties.availabilitySet reference. :code:`
`:code:`
`Minimum api‐version: + 2019‐03‐01. + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar proximity_placement_group: Specifies information about the proximity placement group that + the virtual machine should be assigned to. :code:`
`:code:`
`Minimum api-version: + 2018-04-01. + :vartype proximity_placement_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
`:code:`
`Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
`:code:`
`For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
`:code:`
`For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :vartype eviction_policy: str or + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineEvictionPolicyTypes + :ivar billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :code:`
`:code:`
`Minimum api-version: 2019-03-01. + :vartype billing_profile: ~azure.mgmt.compute.v2022_03_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
`:code:`
`Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar host_group: Specifies information about the dedicated host group that the virtual machine + resides in. :code:`
`:code:`
`Minimum api-version: 2020-06-01. + :code:`
`:code:`
`NOTE: User cannot specify both host and hostGroup properties. + :vartype host_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine instance view. + :vartype instance_view: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineInstanceView + :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: + :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. + :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 + :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. + :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' + 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. + :vartype platform_fault_domain: int + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2022_03_01.models.ScheduledEventsProfile + :ivar user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :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. + :vartype capacity_reservation: + ~azure.mgmt.compute.v2022_03_01.models.CapacityReservationProfile + :ivar application_profile: Specifies the gallery applications that should be made available to + the VM/VMSS. + :vartype application_profile: ~azure.mgmt.compute.v2022_03_01.models.ApplicationProfile + :ivar time_created: Specifies the time at which the Virtual Machine resource was + created.:code:`
    `:code:`
    `Minimum api-version: 2022-03-01. + :vartype time_created: ~datetime.datetime + """ + + _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}, + 'time_created': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + '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'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + identity: Optional["VirtualMachineIdentity"] = None, + zones: Optional[List[str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + hardware_profile: Optional["HardwareProfile"] = None, + storage_profile: Optional["StorageProfile"] = None, + additional_capabilities: Optional["AdditionalCapabilities"] = None, + os_profile: Optional["OSProfile"] = None, + network_profile: Optional["NetworkProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + diagnostics_profile: Optional["DiagnosticsProfile"] = None, + availability_set: Optional["SubResource"] = None, + virtual_machine_scale_set: Optional["SubResource"] = None, + proximity_placement_group: Optional["SubResource"] = None, + priority: Optional[Union[str, "VirtualMachinePriorityTypes"]] = None, + eviction_policy: Optional[Union[str, "VirtualMachineEvictionPolicyTypes"]] = None, + billing_profile: Optional["BillingProfile"] = None, + host: Optional["SubResource"] = None, + host_group: Optional["SubResource"] = None, + license_type: Optional[str] = None, + extensions_time_budget: Optional[str] = None, + platform_fault_domain: Optional[int] = None, + scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, + user_data: Optional[str] = None, + capacity_reservation: Optional["CapacityReservationProfile"] = None, + 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.v2022_03_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: ~azure.mgmt.compute.v2022_03_01.models.ExtendedLocation + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2022_03_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2022_03_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2022_03_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2022_03_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2022_03_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :keyword availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates for Virtual Machines in Azure + `_ + :code:`
    `:code:`
    ` Currently, a VM can only be added to availability set at creation + time. The availability set to which the VM is being added should be under the same resource + group as the availability set resource. An existing VM cannot be added to an availability set. + :code:`
    `:code:`
    `This property cannot exist along with a non-null + properties.virtualMachineScaleSet reference. + :paramtype availability_set: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword virtual_machine_scale_set: Specifies information about the virtual machine scale set + that the virtual machine should be assigned to. Virtual machines specified in the same virtual + machine scale set are allocated to different nodes to maximize availability. Currently, a VM + can only be added to virtual machine scale set at creation time. An existing VM cannot be added + to a virtual machine scale set. :code:`
    `:code:`
    `This property cannot exist along with a + non-null properties.availabilitySet reference. :code:`
    `:code:`
    `Minimum api‐version: + 2019‐03‐01. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword proximity_placement_group: Specifies information about the proximity placement group + that the virtual machine should be assigned to. :code:`
    `:code:`
    `Minimum api-version: + 2018-04-01. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
    `:code:`
    `For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2022_03_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword host_group: Specifies information about the dedicated host group that the virtual + machine resides in. :code:`
    `:code:`
    `Minimum api-version: 2020-06-01. + :code:`
    `:code:`
    `NOTE: User cannot specify both host and hostGroup properties. + :paramtype host_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword extensions_time_budget: Specifies the time alloted for all extensions to start. The + time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified + in ISO 8601 format. The default value is 90 minutes (PT1H30M). :code:`
    `:code:`
    ` Minimum + api-version: 2020-06-01. + :paramtype extensions_time_budget: str + :keyword platform_fault_domain: Specifies the scale set logical fault domain into which the + Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned + to a fault domain that best maintains balance across available fault + domains.:code:`
    `:code:`
  • `This is applicable only if the 'virtualMachineScaleSet' + property of this Virtual Machine is set.:code:`
  • `The Virtual Machine Scale Set that is + referenced, must have 'platformFaultDomainCount' > 1.:code:`
  • `This property cannot be + updated once the Virtual Machine is created.:code:`
  • `Fault domain assignment can be viewed + in the Virtual Machine Instance View.:code:`
    `:code:`
    `Minimum api‐version: 2020‐12‐01. + :paramtype platform_fault_domain: int + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2022_03_01.models.ScheduledEventsProfile + :keyword user_data: UserData for the VM, which must be base-64 encoded. Customer should not + pass any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :paramtype user_data: str + :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.v2022_03_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.v2022_03_01.models.ApplicationProfile + """ + super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) + self.plan = plan + self.resources = None + self.identity = identity + self.zones = zones + self.extended_location = extended_location + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.additional_capabilities = additional_capabilities + self.os_profile = os_profile + self.network_profile = network_profile + self.security_profile = security_profile + self.diagnostics_profile = diagnostics_profile + self.availability_set = availability_set + self.virtual_machine_scale_set = virtual_machine_scale_set + self.proximity_placement_group = proximity_placement_group + self.priority = priority + self.eviction_policy = eviction_policy + self.billing_profile = billing_profile + self.host = host + self.host_group = host_group + self.provisioning_state = None + self.instance_view = None + self.license_type = license_type + self.vm_id = None + self.extensions_time_budget = extensions_time_budget + self.platform_fault_domain = platform_fault_domain + self.scheduled_events_profile = scheduled_events_profile + self.user_data = user_data + self.capacity_reservation = capacity_reservation + self.application_profile = application_profile + self.time_created = None + + +class VirtualMachineAgentInstanceView(msrest.serialization.Model): + """The instance view of the VM Agent running on the virtual machine. + + :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.v2022_03_01.models.VirtualMachineExtensionHandlerInstanceView] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'vm_agent_version': {'key': 'vmAgentVersion', 'type': 'str'}, + 'extension_handlers': {'key': 'extensionHandlers', 'type': '[VirtualMachineExtensionHandlerInstanceView]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + vm_agent_version: Optional[str] = None, + extension_handlers: Optional[List["VirtualMachineExtensionHandlerInstanceView"]] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.VirtualMachineExtensionHandlerInstanceView] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) + self.vm_agent_version = vm_agent_version + self.extension_handlers = extension_handlers + self.statuses = statuses + + +class VirtualMachineAssessPatchesResult(msrest.serialization.Model): + """Describes the properties of an AssessPatches result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2022_03_01.models.PatchOperationStatus + :ivar assessment_activity_id: The activity ID of the operation that produced this result. It is + used to correlate across CRP and extension logs. + :vartype assessment_activity_id: str + :ivar reboot_pending: The overall reboot status of the VM. It will be true when partially + installed patches require a reboot to complete installation but the reboot has not yet + occurred. + :vartype reboot_pending: bool + :ivar critical_and_security_patch_count: The number of critical or security patches that have + been detected as available and not yet installed. + :vartype critical_and_security_patch_count: int + :ivar other_patch_count: The number of all available patches excluding critical and security. + :vartype other_patch_count: int + :ivar start_date_time: The UTC timestamp when the operation began. + :vartype start_date_time: ~datetime.datetime + :ivar available_patches: The list of patches that have been detected as available for + installation. + :vartype available_patches: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineSoftwarePatchProperties] + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2022_03_01.models.ApiError + """ + + _validation = { + 'status': {'readonly': True}, + 'assessment_activity_id': {'readonly': True}, + 'reboot_pending': {'readonly': True}, + 'critical_and_security_patch_count': {'readonly': True}, + 'other_patch_count': {'readonly': True}, + 'start_date_time': {'readonly': True}, + 'available_patches': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'assessment_activity_id': {'key': 'assessmentActivityId', 'type': 'str'}, + 'reboot_pending': {'key': 'rebootPending', 'type': 'bool'}, + 'critical_and_security_patch_count': {'key': 'criticalAndSecurityPatchCount', 'type': 'int'}, + 'other_patch_count': {'key': 'otherPatchCount', 'type': 'int'}, + 'start_date_time': {'key': 'startDateTime', 'type': 'iso-8601'}, + 'available_patches': {'key': 'availablePatches', 'type': '[VirtualMachineSoftwarePatchProperties]'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualMachineAssessPatchesResult, self).__init__(**kwargs) + self.status = None + self.assessment_activity_id = None + self.reboot_pending = None + self.critical_and_security_patch_count = None + self.other_patch_count = None + self.start_date_time = None + self.available_patches = None + self.error = None + + +class VirtualMachineCaptureParameters(msrest.serialization.Model): + """Capture Virtual Machine parameters. + + All required parameters must be populated in order to send to Azure. + + :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. + :vartype overwrite_vhds: bool + """ + + _validation = { + 'vhd_prefix': {'required': True}, + 'destination_container_name': {'required': True}, + 'overwrite_vhds': {'required': True}, + } + + _attribute_map = { + 'vhd_prefix': {'key': 'vhdPrefix', 'type': 'str'}, + 'destination_container_name': {'key': 'destinationContainerName', 'type': 'str'}, + 'overwrite_vhds': {'key': 'overwriteVhds', 'type': 'bool'}, + } + + def __init__( + self, + *, + vhd_prefix: str, + destination_container_name: str, + overwrite_vhds: bool, + **kwargs + ): + """ + :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 + self.overwrite_vhds = overwrite_vhds + + +class VirtualMachineCaptureResult(SubResource): + """Output of virtual machine capture operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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. + :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, + *, + 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 + self.parameters = None + self.resources = None + + +class VirtualMachineExtension(ResourceWithOptionalLocation): + """Describes a Virtual Machine Extension. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar location: Resource location. + :vartype location: str + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: 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. + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :vartype auto_upgrade_minor_version: bool + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :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. + :vartype protected_settings: any + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2022_03_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. + :vartype suppress_failures: bool + :ivar protected_settings_from_key_vault: The extensions protected settings that are passed by + reference, and consumed from key vault. + :vartype protected_settings_from_key_vault: any + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', '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'}, + 'protected_settings_from_key_vault': {'key': 'properties.protectedSettingsFromKeyVault', 'type': 'object'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type_properties_type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, + instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, + suppress_failures: Optional[bool] = None, + protected_settings_from_key_vault: Optional[Any] = None, + **kwargs + ): + """ + :keyword location: 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.v2022_03_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 + :keyword protected_settings_from_key_vault: The extensions protected settings that are passed + by reference, and consumed from key vault. + :paramtype protected_settings_from_key_vault: any + """ + super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type_properties_type = type_properties_type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings + self.provisioning_state = None + self.instance_view = instance_view + self.suppress_failures = suppress_failures + self.protected_settings_from_key_vault = protected_settings_from_key_vault + + +class VirtualMachineExtensionHandlerInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine extension handler. + + :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.v2022_03_01.models.InstanceViewStatus + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + status: Optional["InstanceViewStatus"] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.InstanceViewStatus + """ + super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) + self.type = type + self.type_handler_version = type_handler_version + self.status = status + + +class VirtualMachineExtensionImage(Resource): + """Describes a Virtual Machine Extension Image. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :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. + :vartype vm_scale_set_enabled: bool + :ivar supports_multiple_extensions: Whether the handler can support multiple extensions. + :vartype supports_multiple_extensions: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'operating_system': {'key': 'properties.operatingSystem', 'type': 'str'}, + 'compute_role': {'key': 'properties.computeRole', 'type': 'str'}, + 'handler_schema': {'key': 'properties.handlerSchema', 'type': 'str'}, + 'vm_scale_set_enabled': {'key': 'properties.vmScaleSetEnabled', 'type': 'bool'}, + 'supports_multiple_extensions': {'key': 'properties.supportsMultipleExtensions', 'type': 'bool'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + operating_system: Optional[str] = None, + compute_role: Optional[str] = None, + handler_schema: Optional[str] = None, + vm_scale_set_enabled: Optional[bool] = None, + supports_multiple_extensions: Optional[bool] = None, + **kwargs + ): + """ + :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 + self.handler_schema = handler_schema + self.vm_scale_set_enabled = vm_scale_set_enabled + self.supports_multiple_extensions = supports_multiple_extensions + + +class VirtualMachineExtensionInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine extension. + + :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.v2022_03_01.models.InstanceViewStatus] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, + 'substatuses': {'key': 'substatuses', 'type': '[InstanceViewStatus]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + substatuses: Optional[List["InstanceViewStatus"]] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.InstanceViewStatus] + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) + self.name = name + self.type = type + self.type_handler_version = type_handler_version + self.substatuses = substatuses + self.statuses = statuses + + +class VirtualMachineExtensionsListResult(msrest.serialization.Model): + """The List Extension operation response. + + :ivar value: The list of extensions. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineExtension]'}, + } + + def __init__( + self, + *, + value: Optional[List["VirtualMachineExtension"]] = None, + **kwargs + ): + """ + :keyword value: The list of extensions. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtension] + """ + super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) + self.value = value + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :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. + :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. + :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. + :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. + :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. + :vartype suppress_failures: bool + :ivar protected_settings_from_key_vault: The extensions protected settings that are passed by + reference, and consumed from key vault. + :vartype protected_settings_from_key_vault: any + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + 'suppress_failures': {'key': 'properties.suppressFailures', 'type': 'bool'}, + 'protected_settings_from_key_vault': {'key': 'properties.protectedSettingsFromKeyVault', 'type': 'object'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, + suppress_failures: Optional[bool] = None, + protected_settings_from_key_vault: Optional[Any] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :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 + :keyword protected_settings_from_key_vault: The extensions protected settings that are passed + by reference, and consumed from key vault. + :paramtype protected_settings_from_key_vault: any + """ + super(VirtualMachineExtensionUpdate, self).__init__(tags=tags, **kwargs) + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type = type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings + self.suppress_failures = suppress_failures + self.protected_settings_from_key_vault = protected_settings_from_key_vault + + +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.v2022_03_01.models.InstanceViewStatus + """ + + _validation = { + 'status': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualMachineHealthStatus, self).__init__(**kwargs) + self.status = None + + +class VirtualMachineIdentity(msrest.serialization.Model): + """Identity for the virtual machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of virtual machine identity. This property will only be + provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id associated with the virtual machine. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :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". + :vartype type: str or ~azure.mgmt.compute.v2022_03_01.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the Virtual + Machine. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2022_03_01.models.UserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentitiesValue}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the Virtual + Machine. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2022_03_01.models.UserAssignedIdentitiesValue] + """ + super(VirtualMachineIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class VirtualMachineImageResource(SubResource): + """Virtual machine image resource information. + + All required parameters must be populated in order to send to Azure. + + :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 + `_. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2022_03_01.models.ExtendedLocation + """ + + _validation = { + 'name': {'required': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + } + + def __init__( + self, + *, + name: str, + location: str, + id: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.ExtendedLocation + """ + super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) + self.name = name + self.location = location + self.tags = tags + self.extended_location = extended_location + + +class VirtualMachineImage(VirtualMachineImageResource): + """Describes a Virtual Machine Image. + + All required parameters must be populated in order to send to Azure. + + :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 + `_. + :vartype tags: dict[str, str] + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: ~azure.mgmt.compute.v2022_03_01.models.ExtendedLocation + :ivar plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :vartype plan: ~azure.mgmt.compute.v2022_03_01.models.PurchasePlan + :ivar os_disk_image: Contains the os disk image information. + :vartype os_disk_image: ~azure.mgmt.compute.v2022_03_01.models.OSDiskImage + :ivar data_disk_images: + :vartype data_disk_images: list[~azure.mgmt.compute.v2022_03_01.models.DataDiskImage] + :ivar automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :vartype automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2022_03_01.models.AutomaticOSUpgradeProperties + :ivar hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", + "V2". + :vartype hyper_v_generation: str or + ~azure.mgmt.compute.v2022_03_01.models.HyperVGenerationTypes + :ivar disallowed: Specifies disallowed configuration for the VirtualMachine created from the + image. + :vartype disallowed: ~azure.mgmt.compute.v2022_03_01.models.DisallowedConfiguration + :ivar features: + :vartype features: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageFeature] + :ivar architecture: Specifies the Architecture Type. Possible values include: "x64", "Arm64". + :vartype architecture: str or ~azure.mgmt.compute.v2022_03_01.models.ArchitectureTypes + """ + + _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]'}, + 'architecture': {'key': 'properties.architecture', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + location: str, + id: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + plan: Optional["PurchasePlan"] = None, + os_disk_image: Optional["OSDiskImage"] = None, + data_disk_images: Optional[List["DataDiskImage"]] = None, + automatic_os_upgrade_properties: Optional["AutomaticOSUpgradeProperties"] = None, + hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, + disallowed: Optional["DisallowedConfiguration"] = None, + features: Optional[List["VirtualMachineImageFeature"]] = None, + architecture: Optional[Union[str, "ArchitectureTypes"]] = 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.v2022_03_01.models.ExtendedLocation + :keyword plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :paramtype plan: ~azure.mgmt.compute.v2022_03_01.models.PurchasePlan + :keyword os_disk_image: Contains the os disk image information. + :paramtype os_disk_image: ~azure.mgmt.compute.v2022_03_01.models.OSDiskImage + :keyword data_disk_images: + :paramtype data_disk_images: list[~azure.mgmt.compute.v2022_03_01.models.DataDiskImage] + :keyword automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the + image. + :paramtype automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2022_03_01.models.AutomaticOSUpgradeProperties + :keyword hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: + "V1", "V2". + :paramtype hyper_v_generation: str or + ~azure.mgmt.compute.v2022_03_01.models.HyperVGenerationTypes + :keyword disallowed: Specifies disallowed configuration for the VirtualMachine created from the + image. + :paramtype disallowed: ~azure.mgmt.compute.v2022_03_01.models.DisallowedConfiguration + :keyword features: + :paramtype features: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageFeature] + :keyword architecture: Specifies the Architecture Type. Possible values include: "x64", + "Arm64". + :paramtype architecture: str or ~azure.mgmt.compute.v2022_03_01.models.ArchitectureTypes + """ + super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, extended_location=extended_location, **kwargs) + self.plan = plan + self.os_disk_image = os_disk_image + self.data_disk_images = data_disk_images + self.automatic_os_upgrade_properties = automatic_os_upgrade_properties + self.hyper_v_generation = hyper_v_generation + self.disallowed = disallowed + self.features = features + self.architecture = architecture + + +class VirtualMachineImageFeature(msrest.serialization.Model): + """Specifies additional capabilities supported by the image. + + :ivar name: The name of the feature. + :vartype name: str + :ivar value: The corresponding value for the feature. + :vartype value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + """ + :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 + + +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. + + :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). + :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". + :vartype reboot_setting: str or + ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.WindowsParameters + :ivar linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :vartype linux_parameters: ~azure.mgmt.compute.v2022_03_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, + *, + reboot_setting: Union[str, "VMGuestPatchRebootSetting"], + maximum_duration: Optional[str] = None, + windows_parameters: Optional["WindowsParameters"] = None, + 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.v2022_03_01.models.VMGuestPatchRebootSetting + :keyword windows_parameters: Input for InstallPatches on a Windows VM, as directly received by + the API. + :paramtype windows_parameters: ~azure.mgmt.compute.v2022_03_01.models.WindowsParameters + :keyword linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :paramtype linux_parameters: ~azure.mgmt.compute.v2022_03_01.models.LinuxParameters + """ + super(VirtualMachineInstallPatchesParameters, self).__init__(**kwargs) + self.maximum_duration = maximum_duration + self.reboot_setting = reboot_setting + self.windows_parameters = windows_parameters + self.linux_parameters = linux_parameters + + +class VirtualMachineInstallPatchesResult(msrest.serialization.Model): + """The result summary of an installation operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or + "CompletedWithWarnings.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2022_03_01.models.PatchOperationStatus + :ivar installation_activity_id: The activity ID of the operation that produced this result. It + is used to correlate across CRP and extension logs. + :vartype installation_activity_id: str + :ivar reboot_status: The reboot state of the VM following completion of the operation. Possible + values include: "Unknown", "NotNeeded", "Required", "Started", "Failed", "Completed". + :vartype reboot_status: str or ~azure.mgmt.compute.v2022_03_01.models.VMGuestPatchRebootStatus + :ivar maintenance_window_exceeded: Whether the operation ran out of time before it completed + all its intended actions. + :vartype maintenance_window_exceeded: bool + :ivar excluded_patch_count: The number of patches that were not installed due to the user + blocking their installation. + :vartype excluded_patch_count: int + :ivar not_selected_patch_count: The number of patches that were detected as available for + install, but did not meet the operation's criteria. + :vartype not_selected_patch_count: int + :ivar pending_patch_count: The number of patches that were identified as meeting the + installation criteria, but were not able to be installed. Typically this happens when + maintenanceWindowExceeded == true. + :vartype pending_patch_count: int + :ivar installed_patch_count: The number of patches successfully installed. + :vartype installed_patch_count: int + :ivar failed_patch_count: The number of patches that could not be installed due to some issue. + See errors for details. + :vartype failed_patch_count: int + :ivar patches: The patches that were installed during the operation. + :vartype patches: list[~azure.mgmt.compute.v2022_03_01.models.PatchInstallationDetail] + :ivar start_date_time: The UTC timestamp when the operation began. + :vartype start_date_time: ~datetime.datetime + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2022_03_01.models.ApiError + """ + + _validation = { + 'status': {'readonly': True}, + 'installation_activity_id': {'readonly': True}, + 'reboot_status': {'readonly': True}, + 'maintenance_window_exceeded': {'readonly': True}, + 'excluded_patch_count': {'readonly': True}, + 'not_selected_patch_count': {'readonly': True}, + 'pending_patch_count': {'readonly': True}, + 'installed_patch_count': {'readonly': True}, + 'failed_patch_count': {'readonly': True}, + 'patches': {'readonly': True}, + 'start_date_time': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'installation_activity_id': {'key': 'installationActivityId', 'type': 'str'}, + 'reboot_status': {'key': 'rebootStatus', 'type': 'str'}, + 'maintenance_window_exceeded': {'key': 'maintenanceWindowExceeded', 'type': 'bool'}, + 'excluded_patch_count': {'key': 'excludedPatchCount', 'type': 'int'}, + 'not_selected_patch_count': {'key': 'notSelectedPatchCount', 'type': 'int'}, + 'pending_patch_count': {'key': 'pendingPatchCount', 'type': 'int'}, + 'installed_patch_count': {'key': 'installedPatchCount', 'type': 'int'}, + 'failed_patch_count': {'key': 'failedPatchCount', 'type': 'int'}, + 'patches': {'key': 'patches', 'type': '[PatchInstallationDetail]'}, + 'start_date_time': {'key': 'startDateTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualMachineInstallPatchesResult, self).__init__(**kwargs) + self.status = None + self.installation_activity_id = None + self.reboot_status = None + self.maintenance_window_exceeded = None + self.excluded_patch_count = None + self.not_selected_patch_count = None + self.pending_patch_count = None + self.installed_patch_count = None + self.failed_patch_count = None + self.patches = None + self.start_date_time = None + self.error = None + + +class VirtualMachineInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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". + :vartype hyper_v_generation: str or ~azure.mgmt.compute.v2022_03_01.models.HyperVGenerationType + :ivar rdp_thumb_print: The Remote desktop certificate thumbprint. + :vartype rdp_thumb_print: str + :ivar vm_agent: The VM Agent running on the virtual machine. + :vartype vm_agent: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: + ~azure.mgmt.compute.v2022_03_01.models.MaintenanceRedeployStatus + :ivar disks: The virtual machine disk information. + :vartype disks: list[~azure.mgmt.compute.v2022_03_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionInstanceView] + :ivar vm_health: The health status for the VM. + :vartype vm_health: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineHealthStatus + :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. + :vartype boot_diagnostics: ~azure.mgmt.compute.v2022_03_01.models.BootDiagnosticsInstanceView + :ivar assigned_host: Resource id of the dedicated host, on which the virtual machine is + allocated through automatic placement, when the virtual machine is associated with a dedicated + host group that has automatic placement enabled. :code:`
    `:code:`
    `Minimum api-version: + 2020-06-01. + :vartype assigned_host: str + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + :ivar patch_status: [Preview Feature] The status of virtual machine patch operations. + :vartype patch_status: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePatchStatus + """ + + _validation = { + 'vm_health': {'readonly': True}, + 'assigned_host': {'readonly': True}, + } + + _attribute_map = { + 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'int'}, + 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'int'}, + 'computer_name': {'key': 'computerName', 'type': 'str'}, + 'os_name': {'key': 'osName', 'type': 'str'}, + 'os_version': {'key': 'osVersion', 'type': 'str'}, + 'hyper_v_generation': {'key': 'hyperVGeneration', 'type': 'str'}, + 'rdp_thumb_print': {'key': 'rdpThumbPrint', 'type': 'str'}, + 'vm_agent': {'key': 'vmAgent', 'type': 'VirtualMachineAgentInstanceView'}, + 'maintenance_redeploy_status': {'key': 'maintenanceRedeployStatus', 'type': 'MaintenanceRedeployStatus'}, + 'disks': {'key': 'disks', 'type': '[DiskInstanceView]'}, + 'extensions': {'key': 'extensions', 'type': '[VirtualMachineExtensionInstanceView]'}, + 'vm_health': {'key': 'vmHealth', 'type': 'VirtualMachineHealthStatus'}, + 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, + 'assigned_host': {'key': 'assignedHost', 'type': 'str'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + 'patch_status': {'key': 'patchStatus', 'type': 'VirtualMachinePatchStatus'}, + } + + def __init__( + self, + *, + platform_update_domain: Optional[int] = None, + platform_fault_domain: Optional[int] = None, + computer_name: Optional[str] = None, + os_name: Optional[str] = None, + os_version: Optional[str] = None, + hyper_v_generation: Optional[Union[str, "HyperVGenerationType"]] = None, + rdp_thumb_print: Optional[str] = None, + vm_agent: Optional["VirtualMachineAgentInstanceView"] = None, + maintenance_redeploy_status: Optional["MaintenanceRedeployStatus"] = None, + disks: Optional[List["DiskInstanceView"]] = None, + extensions: Optional[List["VirtualMachineExtensionInstanceView"]] = None, + boot_diagnostics: Optional["BootDiagnosticsInstanceView"] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + patch_status: Optional["VirtualMachinePatchStatus"] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.HyperVGenerationType + :keyword rdp_thumb_print: The Remote desktop certificate thumbprint. + :paramtype rdp_thumb_print: str + :keyword vm_agent: The VM Agent running on the virtual machine. + :paramtype vm_agent: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2022_03_01.models.MaintenanceRedeployStatus + :keyword disks: The virtual machine disk information. + :paramtype disks: list[~azure.mgmt.compute.v2022_03_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionInstanceView] + :keyword boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. :code:`
    `:code:`
    ` You can easily + view the output of your console log. :code:`
    `:code:`
    ` Azure also enables you to see a + screenshot of the VM from the hypervisor. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2022_03_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + :keyword patch_status: [Preview Feature] The status of virtual machine patch operations. + :paramtype patch_status: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePatchStatus + """ + super(VirtualMachineInstanceView, self).__init__(**kwargs) + self.platform_update_domain = platform_update_domain + self.platform_fault_domain = platform_fault_domain + self.computer_name = computer_name + self.os_name = os_name + self.os_version = os_version + self.hyper_v_generation = hyper_v_generation + self.rdp_thumb_print = rdp_thumb_print + self.vm_agent = vm_agent + self.maintenance_redeploy_status = maintenance_redeploy_status + self.disks = disks + self.extensions = extensions + self.vm_health = None + self.boot_diagnostics = boot_diagnostics + self.assigned_host = None + self.statuses = statuses + self.patch_status = patch_status + + +class VirtualMachineIpTag(msrest.serialization.Model): + """Contains the IP tag associated with the public IP address. + + :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 = { + 'ip_tag_type': {'key': 'ipTagType', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_tag_type: Optional[str] = None, + 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 + + +class VirtualMachineListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of virtual machines. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachine] + :ivar next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + the next page of Virtual Machines. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachine]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["VirtualMachine"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of virtual machines. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachine] + :keyword next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to + fetch the next page of Virtual Machines. + :paramtype next_link: str + """ + super(VirtualMachineListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualMachineNetworkInterfaceConfiguration(msrest.serialization.Model): + """Describes a virtual machine network interface configurations. + + All required parameters must be populated in order to send to Azure. + + :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. + :vartype primary: bool + :ivar delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DeleteOptions + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :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.v2022_03_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineNetworkInterfaceIPConfiguration] + :ivar dscp_configuration: + :vartype dscp_configuration: ~azure.mgmt.compute.v2022_03_01.models.SubResource + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, + 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, + 'enable_fpga': {'key': 'properties.enableFpga', 'type': 'bool'}, + 'enable_ip_forwarding': {'key': 'properties.enableIPForwarding', 'type': 'bool'}, + 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineNetworkInterfaceDnsSettingsConfiguration'}, + 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineNetworkInterfaceIPConfiguration]'}, + 'dscp_configuration': {'key': 'properties.dscpConfiguration', 'type': 'SubResource'}, + } + + def __init__( + self, + *, + name: str, + primary: Optional[bool] = None, + delete_option: Optional[Union[str, "DeleteOptions"]] = None, + enable_accelerated_networking: Optional[bool] = None, + enable_fpga: Optional[bool] = None, + enable_ip_forwarding: Optional[bool] = None, + network_security_group: Optional["SubResource"] = None, + dns_settings: Optional["VirtualMachineNetworkInterfaceDnsSettingsConfiguration"] = None, + ip_configurations: Optional[List["VirtualMachineNetworkInterfaceIPConfiguration"]] = None, + 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.v2022_03_01.models.DeleteOptions + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :paramtype enable_fpga: bool + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword network_security_group: The network security group. + :paramtype network_security_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineNetworkInterfaceIPConfiguration] + :keyword dscp_configuration: + :paramtype dscp_configuration: ~azure.mgmt.compute.v2022_03_01.models.SubResource + """ + super(VirtualMachineNetworkInterfaceConfiguration, self).__init__(**kwargs) + self.name = name + self.primary = primary + self.delete_option = delete_option + self.enable_accelerated_networking = enable_accelerated_networking + self.enable_fpga = enable_fpga + self.enable_ip_forwarding = enable_ip_forwarding + self.network_security_group = network_security_group + self.dns_settings = dns_settings + self.ip_configurations = ip_configurations + self.dscp_configuration = dscp_configuration + + +class VirtualMachineNetworkInterfaceDnsSettingsConfiguration(msrest.serialization.Model): + """Describes a virtual machines network configuration's DNS settings. + + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] + """ + + _attribute_map = { + 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, + } + + def __init__( + self, + *, + 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 + + +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. + + :ivar name: Required. The IP configuration name. + :vartype name: str + :ivar subnet: Specifies the identifier of the subnet. + :vartype subnet: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePublicIPAddressConfiguration + :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". + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2022_03_01.models.IPVersions + :ivar application_security_groups: Specifies an array of references to application security + group. + :vartype application_security_groups: list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :ivar application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A virtual machine can reference backend address pools of + multiple application gateways. Multiple virtual machines cannot use the same application + gateway. + :vartype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :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]. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'subnet': {'key': 'properties.subnet', 'type': 'SubResource'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'public_ip_address_configuration': {'key': 'properties.publicIPAddressConfiguration', 'type': 'VirtualMachinePublicIPAddressConfiguration'}, + 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, + 'application_security_groups': {'key': 'properties.applicationSecurityGroups', 'type': '[SubResource]'}, + 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', 'type': '[SubResource]'}, + 'load_balancer_backend_address_pools': {'key': 'properties.loadBalancerBackendAddressPools', 'type': '[SubResource]'}, + } + + def __init__( + self, + *, + name: str, + subnet: Optional["SubResource"] = None, + primary: Optional[bool] = None, + public_ip_address_configuration: Optional["VirtualMachinePublicIPAddressConfiguration"] = None, + private_ip_address_version: Optional[Union[str, "IPVersions"]] = None, + application_security_groups: Optional[List["SubResource"]] = None, + application_gateway_backend_address_pools: Optional[List["SubResource"]] = None, + 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.v2022_03_01.models.SubResource + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePublicIPAddressConfiguration + :keyword private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it + represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + Possible values are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2022_03_01.models.IPVersions + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :keyword application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A virtual machine can reference backend address pools of + multiple application gateways. Multiple virtual machines cannot use the same application + gateway. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :keyword load_balancer_backend_address_pools: Specifies an array of references to backend + address pools of load balancers. A virtual machine can reference backend address pools of one + public and one internal load balancer. [Multiple virtual machines cannot use the same basic sku + load balancer]. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + """ + super(VirtualMachineNetworkInterfaceIPConfiguration, self).__init__(**kwargs) + self.name = name + self.subnet = subnet + self.primary = primary + self.public_ip_address_configuration = public_ip_address_configuration + self.private_ip_address_version = private_ip_address_version + self.application_security_groups = application_security_groups + self.application_gateway_backend_address_pools = application_gateway_backend_address_pools + self.load_balancer_backend_address_pools = load_balancer_backend_address_pools + + +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. + + :ivar available_patch_summary: The available patch summary of the latest assessment operation + for the virtual machine. + :vartype available_patch_summary: ~azure.mgmt.compute.v2022_03_01.models.AvailablePatchSummary + :ivar last_patch_installation_summary: The installation summary of the latest installation + operation for the virtual machine. + :vartype last_patch_installation_summary: + ~azure.mgmt.compute.v2022_03_01.models.LastPatchInstallationSummary + :ivar configuration_statuses: The enablement status of the specified patchMode. + :vartype configuration_statuses: + list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + + _validation = { + 'configuration_statuses': {'readonly': True}, + } + + _attribute_map = { + 'available_patch_summary': {'key': 'availablePatchSummary', 'type': 'AvailablePatchSummary'}, + 'last_patch_installation_summary': {'key': 'lastPatchInstallationSummary', 'type': 'LastPatchInstallationSummary'}, + 'configuration_statuses': {'key': 'configurationStatuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + available_patch_summary: Optional["AvailablePatchSummary"] = None, + last_patch_installation_summary: Optional["LastPatchInstallationSummary"] = None, + **kwargs + ): + """ + :keyword available_patch_summary: The available patch summary of the latest assessment + operation for the virtual machine. + :paramtype available_patch_summary: + ~azure.mgmt.compute.v2022_03_01.models.AvailablePatchSummary + :keyword last_patch_installation_summary: The installation summary of the latest installation + operation for the virtual machine. + :paramtype last_patch_installation_summary: + ~azure.mgmt.compute.v2022_03_01.models.LastPatchInstallationSummary + """ + super(VirtualMachinePatchStatus, self).__init__(**kwargs) + self.available_patch_summary = available_patch_summary + self.last_patch_installation_summary = last_patch_installation_summary + 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. + + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar sku: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + :vartype sku: ~azure.mgmt.compute.v2022_03_01.models.PublicIPAddressSku + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar delete_option: Specify what happens to the public IP address when the VM is deleted. + Possible values include: "Delete", "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DeleteOptions + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values + are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2022_03_01.models.IPVersions + :ivar public_ip_allocation_method: Specify the public IP allocation type. Possible values + include: "Dynamic", "Static". + :vartype public_ip_allocation_method: str or + ~azure.mgmt.compute.v2022_03_01.models.PublicIPAllocationMethod + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'PublicIPAddressSku'}, + 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, + 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachinePublicIPAddressDnsSettingsConfiguration'}, + 'ip_tags': {'key': 'properties.ipTags', 'type': '[VirtualMachineIpTag]'}, + 'public_ip_prefix': {'key': 'properties.publicIPPrefix', 'type': 'SubResource'}, + 'public_ip_address_version': {'key': 'properties.publicIPAddressVersion', 'type': 'str'}, + 'public_ip_allocation_method': {'key': 'properties.publicIPAllocationMethod', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + sku: Optional["PublicIPAddressSku"] = None, + idle_timeout_in_minutes: Optional[int] = None, + delete_option: Optional[Union[str, "DeleteOptions"]] = None, + dns_settings: Optional["VirtualMachinePublicIPAddressDnsSettingsConfiguration"] = None, + ip_tags: Optional[List["VirtualMachineIpTag"]] = None, + public_ip_prefix: Optional["SubResource"] = None, + public_ip_address_version: Optional[Union[str, "IPVersions"]] = None, + 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. It can only be set with OrchestrationMode as + Flexible. + :paramtype sku: ~azure.mgmt.compute.v2022_03_01.models.PublicIPAddressSku + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword delete_option: Specify what happens to the public IP address when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DeleteOptions + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePublicIPAddressDnsSettingsConfiguration + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it + represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + Possible values are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2022_03_01.models.IPVersions + :keyword public_ip_allocation_method: Specify the public IP allocation type. Possible values + include: "Dynamic", "Static". + :paramtype public_ip_allocation_method: str or + ~azure.mgmt.compute.v2022_03_01.models.PublicIPAllocationMethod + """ + super(VirtualMachinePublicIPAddressConfiguration, self).__init__(**kwargs) + self.name = name + self.sku = sku + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.delete_option = delete_option + self.dns_settings = dns_settings + self.ip_tags = ip_tags + self.public_ip_prefix = public_ip_prefix + self.public_ip_address_version = public_ip_address_version + self.public_ip_allocation_method = public_ip_allocation_method + + +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. + + :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. + :vartype domain_name_label: str + """ + + _validation = { + 'domain_name_label': {'required': True}, + } + + _attribute_map = { + 'domain_name_label': {'key': 'domainNameLabel', 'type': 'str'}, + } + + def __init__( + self, + *, + 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 + + +class VirtualMachineReimageParameters(msrest.serialization.Model): + """Parameters for Reimaging Virtual Machine. NOTE: Virtual Machine OS disk will always be reimaged. + + :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. + :vartype temp_disk: bool + """ + + _attribute_map = { + 'temp_disk': {'key': 'tempDisk', 'type': 'bool'}, + } + + def __init__( + self, + *, + 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 + + +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 + :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.v2022_03_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2022_03_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: + list[~azure.mgmt.compute.v2022_03_01.models.RunCommandInputParameter] + :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. + :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. + :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. + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :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. + :vartype instance_view: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineRunCommandInstanceView + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'VirtualMachineRunCommandScriptSource'}, + 'parameters': {'key': 'properties.parameters', 'type': '[RunCommandInputParameter]'}, + 'protected_parameters': {'key': 'properties.protectedParameters', 'type': '[RunCommandInputParameter]'}, + 'async_execution': {'key': 'properties.asyncExecution', 'type': 'bool'}, + 'run_as_user': {'key': 'properties.runAsUser', 'type': 'str'}, + 'run_as_password': {'key': 'properties.runAsPassword', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'properties.timeoutInSeconds', 'type': 'int'}, + 'output_blob_uri': {'key': 'properties.outputBlobUri', 'type': 'str'}, + 'error_blob_uri': {'key': 'properties.errorBlobUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineRunCommandInstanceView'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + source: Optional["VirtualMachineRunCommandScriptSource"] = None, + parameters: Optional[List["RunCommandInputParameter"]] = None, + protected_parameters: Optional[List["RunCommandInputParameter"]] = None, + async_execution: Optional[bool] = False, + run_as_user: Optional[str] = None, + run_as_password: Optional[str] = None, + timeout_in_seconds: Optional[int] = None, + output_blob_uri: Optional[str] = None, + error_blob_uri: Optional[str] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2022_03_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2022_03_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ + super(VirtualMachineRunCommand, self).__init__(location=location, tags=tags, **kwargs) + self.source = source + self.parameters = parameters + self.protected_parameters = protected_parameters + self.async_execution = async_execution + self.run_as_user = run_as_user + self.run_as_password = run_as_password + self.timeout_in_seconds = timeout_in_seconds + self.output_blob_uri = output_blob_uri + self.error_blob_uri = error_blob_uri + self.provisioning_state = None + self.instance_view = None + + +class VirtualMachineRunCommandInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine run command. + + :ivar execution_state: Script execution status. Possible values include: "Unknown", "Pending", + "Running", "Failed", "Succeeded", "TimedOut", "Canceled". + :vartype execution_state: str or ~azure.mgmt.compute.v2022_03_01.models.ExecutionState + :ivar execution_message: Communicate script configuration errors or execution messages. + :vartype execution_message: str + :ivar exit_code: Exit code returned from script execution. + :vartype exit_code: int + :ivar output: Script output stream. + :vartype output: str + :ivar error: Script error stream. + :vartype error: str + :ivar start_time: Script start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Script end time. + :vartype end_time: ~datetime.datetime + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'execution_state': {'key': 'executionState', 'type': 'str'}, + 'execution_message': {'key': 'executionMessage', 'type': 'str'}, + 'exit_code': {'key': 'exitCode', 'type': 'int'}, + 'output': {'key': 'output', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + execution_state: Optional[Union[str, "ExecutionState"]] = None, + execution_message: Optional[str] = None, + exit_code: Optional[int] = None, + output: Optional[str] = None, + error: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + """ + :keyword execution_state: Script execution status. Possible values include: "Unknown", + "Pending", "Running", "Failed", "Succeeded", "TimedOut", "Canceled". + :paramtype execution_state: str or ~azure.mgmt.compute.v2022_03_01.models.ExecutionState + :keyword execution_message: Communicate script configuration errors or execution messages. + :paramtype execution_message: str + :keyword exit_code: Exit code returned from script execution. + :paramtype exit_code: int + :keyword output: Script output stream. + :paramtype output: str + :keyword error: Script error stream. + :paramtype error: str + :keyword start_time: Script start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Script end time. + :paramtype end_time: ~datetime.datetime + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + super(VirtualMachineRunCommandInstanceView, self).__init__(**kwargs) + self.execution_state = execution_state + self.execution_message = execution_message + self.exit_code = exit_code + self.output = output + self.error = error + self.start_time = start_time + self.end_time = end_time + self.statuses = statuses + + +class VirtualMachineRunCommandScriptSource(msrest.serialization.Model): + """Describes the script sources for run command. + + :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 = { + 'script': {'key': 'script', 'type': 'str'}, + 'script_uri': {'key': 'scriptUri', 'type': 'str'}, + 'command_id': {'key': 'commandId', 'type': 'str'}, + } + + def __init__( + self, + *, + script: Optional[str] = None, + script_uri: Optional[str] = None, + command_id: Optional[str] = None, + **kwargs + ): + """ + :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 + self.command_id = command_id + + +class VirtualMachineRunCommandsListResult(msrest.serialization.Model): + """The List run command operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of run commands. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineRunCommand] + :ivar next_link: The uri to fetch the next page of run commands. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineRunCommand]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["VirtualMachineRunCommand"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of run commands. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineRunCommand] + :keyword next_link: The uri to fetch the next page of run commands. + :paramtype next_link: str + """ + super(VirtualMachineRunCommandsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualMachineRunCommandUpdate(UpdateResource): + """Describes a Virtual Machine run command. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.compute.v2022_03_01.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: + list[~azure.mgmt.compute.v2022_03_01.models.RunCommandInputParameter] + :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. + :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. + :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. + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :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. + :vartype instance_view: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineRunCommandInstanceView + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'VirtualMachineRunCommandScriptSource'}, + 'parameters': {'key': 'properties.parameters', 'type': '[RunCommandInputParameter]'}, + 'protected_parameters': {'key': 'properties.protectedParameters', 'type': '[RunCommandInputParameter]'}, + 'async_execution': {'key': 'properties.asyncExecution', 'type': 'bool'}, + 'run_as_user': {'key': 'properties.runAsUser', 'type': 'str'}, + 'run_as_password': {'key': 'properties.runAsPassword', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'properties.timeoutInSeconds', 'type': 'int'}, + 'output_blob_uri': {'key': 'properties.outputBlobUri', 'type': 'str'}, + 'error_blob_uri': {'key': 'properties.errorBlobUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineRunCommandInstanceView'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + source: Optional["VirtualMachineRunCommandScriptSource"] = None, + parameters: Optional[List["RunCommandInputParameter"]] = None, + protected_parameters: Optional[List["RunCommandInputParameter"]] = None, + async_execution: Optional[bool] = False, + run_as_user: Optional[str] = None, + run_as_password: Optional[str] = None, + timeout_in_seconds: Optional[int] = None, + output_blob_uri: Optional[str] = None, + error_blob_uri: Optional[str] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.VirtualMachineRunCommandScriptSource + :keyword parameters: The parameters used by the script. + :paramtype parameters: list[~azure.mgmt.compute.v2022_03_01.models.RunCommandInputParameter] + :keyword protected_parameters: The parameters used by the script. + :paramtype protected_parameters: + list[~azure.mgmt.compute.v2022_03_01.models.RunCommandInputParameter] + :keyword async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :paramtype async_execution: bool + :keyword run_as_user: Specifies the user account on the VM when executing the run command. + :paramtype run_as_user: str + :keyword run_as_password: Specifies the user account password on the VM when executing the run + command. + :paramtype run_as_password: str + :keyword timeout_in_seconds: The timeout in seconds to execute the run command. + :paramtype timeout_in_seconds: int + :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :paramtype output_blob_uri: str + :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :paramtype error_blob_uri: str + """ + super(VirtualMachineRunCommandUpdate, self).__init__(tags=tags, **kwargs) + self.source = source + self.parameters = parameters + self.protected_parameters = protected_parameters + self.async_execution = async_execution + self.run_as_user = run_as_user + self.run_as_password = run_as_password + self.timeout_in_seconds = timeout_in_seconds + self.output_blob_uri = output_blob_uri + self.error_blob_uri = error_blob_uri + self.provisioning_state = None + self.instance_view = None + + +class VirtualMachineScaleSet(Resource): + """Describes a Virtual Machine Scale Set. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :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.v2022_03_01.models.Sku + :ivar plan: Specifies information about the marketplace image used to create the virtual + machine. This element is only used for marketplace images. Before you can use a marketplace + image from an API, you must enable the image for programmatic use. In the Azure portal, find + the marketplace image that you want to use and then click **Want to deploy programmatically, + Get Started ->**. Enter any required information and then click **Save**. + :vartype plan: ~azure.mgmt.compute.v2022_03_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetIdentity + :ivar zones: The virtual machine scale set zones. NOTE: Availability zones can only be set when + you create the scale set. + :vartype zones: list[str] + :ivar extended_location: The extended location of the Virtual Machine Scale Set. + :vartype extended_location: ~azure.mgmt.compute.v2022_03_01.models.ExtendedLocation + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2022_03_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2022_03_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :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. + :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 + :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. + :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. + :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. + :vartype proximity_placement_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar host_group: Specifies information about the dedicated host group that the virtual machine + scale set resides in. :code:`
    `:code:`
    `Minimum api-version: 2020-06-01. + :vartype host_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the + Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines + have the capability to support attaching managed data disks with UltraSSD_LRS storage account + type. + :vartype additional_capabilities: ~azure.mgmt.compute.v2022_03_01.models.AdditionalCapabilities + :ivar scale_in_policy: Specifies the policies applied when scaling in Virtual Machines in the + Virtual Machine Scale Set. + :vartype scale_in_policy: ~azure.mgmt.compute.v2022_03_01.models.ScaleInPolicy + :ivar orchestration_mode: Specifies the orchestration mode for the virtual machine scale set. + Possible values include: "Uniform", "Flexible". + :vartype orchestration_mode: str or ~azure.mgmt.compute.v2022_03_01.models.OrchestrationMode + :ivar spot_restore_policy: Specifies the Spot Restore properties for the virtual machine scale + set. + :vartype spot_restore_policy: ~azure.mgmt.compute.v2022_03_01.models.SpotRestorePolicy + :ivar time_created: Specifies the time at which the Virtual Machine Scale Set resource was + created.:code:`
    `:code:`
    `Minimum api-version: 2022-03-01. + :vartype time_created: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'unique_id': {'readonly': True}, + 'time_created': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + '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'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + plan: Optional["Plan"] = None, + identity: Optional["VirtualMachineScaleSetIdentity"] = None, + zones: Optional[List[str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + upgrade_policy: Optional["UpgradePolicy"] = None, + automatic_repairs_policy: Optional["AutomaticRepairsPolicy"] = None, + virtual_machine_profile: Optional["VirtualMachineScaleSetVMProfile"] = None, + overprovision: Optional[bool] = None, + do_not_run_extensions_on_overprovisioned_v_ms: Optional[bool] = None, + single_placement_group: Optional[bool] = None, + zone_balance: Optional[bool] = None, + platform_fault_domain_count: Optional[int] = None, + proximity_placement_group: Optional["SubResource"] = None, + host_group: Optional["SubResource"] = None, + additional_capabilities: Optional["AdditionalCapabilities"] = None, + scale_in_policy: Optional["ScaleInPolicy"] = None, + orchestration_mode: Optional[Union[str, "OrchestrationMode"]] = None, + 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.v2022_03_01.models.Sku + :keyword plan: Specifies information about the marketplace image used to create the virtual + machine. This element is only used for marketplace images. Before you can use a marketplace + image from an API, you must enable the image for programmatic use. In the Azure portal, find + the marketplace image that you want to use and then click **Want to deploy programmatically, + Get Started ->**. Enter any required information and then click **Save**. + :paramtype plan: ~azure.mgmt.compute.v2022_03_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetIdentity + :keyword zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :paramtype zones: list[str] + :keyword extended_location: The extended location of the Virtual Machine Scale Set. + :paramtype extended_location: ~azure.mgmt.compute.v2022_03_01.models.ExtendedLocation + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2022_03_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2022_03_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword do_not_run_extensions_on_overprovisioned_v_ms: When Overprovision is enabled, + extensions are launched only on the requested number of VMs which are finally kept. This + property will hence ensure that the extensions do not run on the extra overprovisioned VMs. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword single_placement_group: When true this limits the scale set to a single placement + group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be + modified to false. However, if singlePlacementGroup is false, it may not be modified to true. + :paramtype single_placement_group: bool + :keyword zone_balance: Whether to force strictly even Virtual Machine distribution cross + x-zones in case there is zone outage. 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.v2022_03_01.models.SubResource + :keyword host_group: Specifies information about the dedicated host group that the virtual + machine scale set resides in. :code:`
    `:code:`
    `Minimum api-version: 2020-06-01. + :paramtype host_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines + have the capability to support attaching managed data disks with UltraSSD_LRS storage account + type. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.ScaleInPolicy + :keyword orchestration_mode: Specifies the orchestration mode for the virtual machine scale + set. Possible values include: "Uniform", "Flexible". + :paramtype orchestration_mode: str or ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.SpotRestorePolicy + """ + super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.plan = plan + self.identity = identity + self.zones = zones + self.extended_location = extended_location + self.upgrade_policy = upgrade_policy + self.automatic_repairs_policy = automatic_repairs_policy + self.virtual_machine_profile = virtual_machine_profile + self.provisioning_state = None + self.overprovision = overprovision + self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms + self.unique_id = None + self.single_placement_group = single_placement_group + self.zone_balance = zone_balance + self.platform_fault_domain_count = platform_fault_domain_count + self.proximity_placement_group = proximity_placement_group + self.host_group = host_group + self.additional_capabilities = additional_capabilities + self.scale_in_policy = scale_in_policy + self.orchestration_mode = orchestration_mode + self.spot_restore_policy = spot_restore_policy + self.time_created = 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. + + :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. + :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". + :vartype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :ivar write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :vartype write_accelerator_enabled: bool + :ivar create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :vartype create_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskCreateOptionTypes + :ivar disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + used to overwrite the size of the disk in a virtual machine image. :code:`
    `:code:`
    ` + This value cannot be larger than 1023 GB. + :vartype disk_size_gb: int + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetManagedDiskParameters + :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. + :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. + :vartype disk_m_bps_read_write: long + :ivar delete_option: Specifies whether data disk should be deleted or detached upon VMSS Flex + deletion (This feature is available for VMSS with Flexible OrchestrationMode + only).:code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this + value is used, the data disk is deleted when the VMSS Flex VM is + deleted.:code:`
    `:code:`
    ` **Detach** If this value is used, the data disk is retained + after VMSS Flex VM is deleted.:code:`
    `:code:`
    ` The default value is set to **Delete**. + Possible values include: "Delete", "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskDeleteOptionTypes + """ + + _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'}, + 'delete_option': {'key': 'deleteOption', 'type': 'str'}, + } + + def __init__( + self, + *, + lun: int, + create_option: Union[str, "DiskCreateOptionTypes"], + name: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + disk_size_gb: Optional[int] = None, + managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, + disk_iops_read_write: Optional[int] = None, + disk_m_bps_read_write: Optional[int] = None, + delete_option: Optional[Union[str, "DiskDeleteOptionTypes"]] = 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.v2022_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskCreateOptionTypes + :keyword disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can + be used to overwrite the size of the disk in a virtual machine image. :code:`
    `:code:`
    ` + This value cannot be larger than 1023 GB. + :paramtype disk_size_gb: int + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetManagedDiskParameters + :keyword disk_iops_read_write: Specifies the Read-Write IOPS for the managed disk. Should be + used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be + assigned based on diskSizeGB. + :paramtype disk_iops_read_write: long + :keyword disk_m_bps_read_write: Specifies the bandwidth in MB per second for the managed disk. + Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value + would be assigned based on diskSizeGB. + :paramtype disk_m_bps_read_write: long + :keyword delete_option: Specifies whether data disk should be deleted or detached upon VMSS + Flex deletion (This feature is available for VMSS with Flexible OrchestrationMode + only).:code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this + value is used, the data disk is deleted when the VMSS Flex VM is + deleted.:code:`
    `:code:`
    ` **Detach** If this value is used, the data disk is retained + after VMSS Flex VM is deleted.:code:`
    `:code:`
    ` The default value is set to **Delete**. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskDeleteOptionTypes + """ + super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) + self.name = name + self.lun = lun + self.caching = caching + self.write_accelerator_enabled = write_accelerator_enabled + self.create_option = create_option + self.disk_size_gb = disk_size_gb + self.managed_disk = managed_disk + self.disk_iops_read_write = disk_iops_read_write + self.disk_m_bps_read_write = disk_m_bps_read_write + self.delete_option = delete_option + + +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 + :ivar name: The name of the extension. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar force_update_tag: If a value is provided and is different from the previous value, the + extension handler will be forced to update even if the extension configuration has not changed. + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :vartype auto_upgrade_minor_version: bool + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :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. + :vartype protected_settings: any + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :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. + :vartype suppress_failures: bool + :ivar protected_settings_from_key_vault: The extensions protected settings that are passed by + reference, and consumed from key vault. + :vartype protected_settings_from_key_vault: any + """ + + _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'}, + 'protected_settings_from_key_vault': {'key': 'properties.protectedSettingsFromKeyVault', 'type': 'object'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type_properties_type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, + provision_after_extensions: Optional[List[str]] = None, + suppress_failures: Optional[bool] = None, + protected_settings_from_key_vault: Optional[Any] = None, + **kwargs + ): + """ + :keyword name: The name of the extension. + :paramtype name: str + :keyword force_update_tag: If a value is provided and is different from the previous value, the + extension handler will be forced to update even if the extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_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 + :keyword protected_settings_from_key_vault: The extensions protected settings that are passed + by reference, and consumed from key vault. + :paramtype protected_settings_from_key_vault: any + """ + super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) + self.name = name + self.type = None + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type_properties_type = type_properties_type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings + self.provisioning_state = None + self.provision_after_extensions = provision_after_extensions + self.suppress_failures = suppress_failures + self.protected_settings_from_key_vault = protected_settings_from_key_vault + + +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. + + :ivar value: Required. The list of VM scale set extensions. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtension] + :ivar next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + with this to fetch the next page of VM scale set extensions. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetExtension]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["VirtualMachineScaleSetExtension"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of VM scale set extensions. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtension] + :keyword next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + with this to fetch the next page of VM scale set extensions. + :paramtype next_link: str + """ + super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualMachineScaleSetExtensionProfile(msrest.serialization.Model): + """Describes a virtual machine scale set extension profile. + + :ivar extensions: The virtual machine scale set child extension resources. + :vartype extensions: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtension] + :ivar extensions_time_budget: Specifies the time alloted for all extensions to start. The time + duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in + ISO 8601 format. The default value is 90 minutes (PT1H30M). :code:`
    `:code:`
    ` Minimum + api-version: 2020-06-01. + :vartype extensions_time_budget: str + """ + + _attribute_map = { + 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, + 'extensions_time_budget': {'key': 'extensionsTimeBudget', 'type': 'str'}, + } + + def __init__( + self, + *, + extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, + extensions_time_budget: Optional[str] = None, + **kwargs + ): + """ + :keyword extensions: The virtual machine scale set child extension resources. + :paramtype extensions: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtension] + :keyword extensions_time_budget: Specifies the time alloted for all extensions to start. The + time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified + in ISO 8601 format. The default value is 90 minutes (PT1H30M). :code:`
    `:code:`
    ` Minimum + api-version: 2020-06-01. + :paramtype extensions_time_budget: str + """ + super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) + self.extensions = extensions + self.extensions_time_budget = extensions_time_budget + + +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 + :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. + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :vartype auto_upgrade_minor_version: bool + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :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. + :vartype protected_settings: any + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :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. + :vartype suppress_failures: bool + :ivar protected_settings_from_key_vault: The extensions protected settings that are passed by + reference, and consumed from key vault. + :vartype protected_settings_from_key_vault: any + """ + + _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'}, + 'protected_settings_from_key_vault': {'key': 'properties.protectedSettingsFromKeyVault', 'type': 'object'}, + } + + def __init__( + self, + *, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type_properties_type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, + provision_after_extensions: Optional[List[str]] = None, + suppress_failures: Optional[bool] = None, + protected_settings_from_key_vault: Optional[Any] = 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 + :keyword protected_settings_from_key_vault: The extensions protected settings that are passed + by reference, and consumed from key vault. + :paramtype protected_settings_from_key_vault: any + """ + super(VirtualMachineScaleSetExtensionUpdate, self).__init__(**kwargs) + self.name = None + self.type = None + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type_properties_type = type_properties_type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings + self.provisioning_state = None + self.provision_after_extensions = provision_after_extensions + self.suppress_failures = suppress_failures + self.protected_settings_from_key_vault = protected_settings_from_key_vault + + +class VirtualMachineScaleSetHardwareProfile(msrest.serialization.Model): + """Specifies the hardware settings for the virtual machine scale set. + + :ivar vm_size_properties: Specifies the properties for customizing the size of the virtual + machine. Minimum api-version: 2022-03-01. :code:`
    `:code:`
    ` Please follow the + instructions in `VM Customization `_ for more details. + :vartype vm_size_properties: ~azure.mgmt.compute.v2022_03_01.models.VMSizeProperties + """ + + _attribute_map = { + 'vm_size_properties': {'key': 'vmSizeProperties', 'type': 'VMSizeProperties'}, + } + + def __init__( + self, + *, + vm_size_properties: Optional["VMSizeProperties"] = None, + **kwargs + ): + """ + :keyword vm_size_properties: Specifies the properties for customizing the size of the virtual + machine. Minimum api-version: 2022-03-01. :code:`
    `:code:`
    ` Please follow the + instructions in `VM Customization `_ for more details. + :paramtype vm_size_properties: ~azure.mgmt.compute.v2022_03_01.models.VMSizeProperties + """ + super(VirtualMachineScaleSetHardwareProfile, self).__init__(**kwargs) + self.vm_size_properties = vm_size_properties + + +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 + :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". + :vartype type: str or ~azure.mgmt.compute.v2022_03_01.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the virtual machine + scale set. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the virtual + machine scale set. The user identity dictionary key references will be ARM resource ids in the + form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ + super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): + """VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar virtual_machine: The instance view status summary for the virtual machine scale set. + :vartype virtual_machine: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary + :ivar extensions: The extensions information. + :vartype extensions: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMExtensionsSummary] + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + :ivar orchestration_services: The orchestration services information. + :vartype orchestration_services: + list[~azure.mgmt.compute.v2022_03_01.models.OrchestrationServiceSummary] + """ + + _validation = { + 'virtual_machine': {'readonly': True}, + 'extensions': {'readonly': True}, + 'orchestration_services': {'readonly': True}, + } + + _attribute_map = { + 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, + 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + 'orchestration_services': {'key': 'orchestrationServices', 'type': '[OrchestrationServiceSummary]'}, + } + + def __init__( + self, + *, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + """ + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + """ + super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) + self.virtual_machine = None + self.extensions = None + self.statuses = statuses + self.orchestration_services = None + + +class VirtualMachineScaleSetInstanceViewStatusesSummary(msrest.serialization.Model): + """Instance view statuses summary for virtual machines of a virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar statuses_summary: The extensions information. + :vartype statuses_summary: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineStatusCodeCount] + """ + + _validation = { + 'statuses_summary': {'readonly': True}, + } + + _attribute_map = { + 'statuses_summary': {'key': 'statusesSummary', 'type': '[VirtualMachineStatusCodeCount]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) + self.statuses_summary = None + + +class VirtualMachineScaleSetIPConfiguration(SubResource): + """Describes a virtual machine scale set network profile's IP configuration. + + All required parameters must be populated in order to send to Azure. + + :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.v2022_03_01.models.ApiEntityReference + :ivar primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :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". + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2022_03_01.models.IPVersion + :ivar application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A scale set can reference backend address pools of + multiple application gateways. Multiple scale sets cannot use the same application gateway. + :vartype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :ivar application_security_groups: Specifies an array of references to application security + group. + :vartype application_security_groups: list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :ivar load_balancer_backend_address_pools: Specifies an array of references to backend address + pools of load balancers. A scale set can reference backend address pools of one public and one + internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: Specifies an array of references to inbound Nat pools of + the load balancers. A scale set can reference inbound nat pools of one public and one internal + load balancer. Multiple scale sets cannot use the same basic sku load balancer. + :vartype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subnet': {'key': 'properties.subnet', 'type': 'ApiEntityReference'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'public_ip_address_configuration': {'key': 'properties.publicIPAddressConfiguration', 'type': 'VirtualMachineScaleSetPublicIPAddressConfiguration'}, + 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, + 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', 'type': '[SubResource]'}, + 'application_security_groups': {'key': 'properties.applicationSecurityGroups', 'type': '[SubResource]'}, + 'load_balancer_backend_address_pools': {'key': 'properties.loadBalancerBackendAddressPools', 'type': '[SubResource]'}, + 'load_balancer_inbound_nat_pools': {'key': 'properties.loadBalancerInboundNatPools', 'type': '[SubResource]'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + subnet: Optional["ApiEntityReference"] = None, + primary: Optional[bool] = None, + public_ip_address_configuration: Optional["VirtualMachineScaleSetPublicIPAddressConfiguration"] = None, + private_ip_address_version: Optional[Union[str, "IPVersion"]] = None, + application_gateway_backend_address_pools: Optional[List["SubResource"]] = None, + application_security_groups: Optional[List["SubResource"]] = None, + load_balancer_backend_address_pools: Optional[List["SubResource"]] = None, + load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.ApiEntityReference + :keyword primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :keyword private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it + represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + Possible values are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2022_03_01.models.IPVersion + :keyword application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A scale set can reference backend address pools of + multiple application gateways. Multiple scale sets cannot use the same application gateway. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :keyword load_balancer_backend_address_pools: Specifies an array of references to backend + address pools of load balancers. A scale set can reference backend address pools of one public + and one internal load balancer. Multiple scale sets cannot use the same basic sku load + balancer. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: Specifies an array of references to inbound Nat pools + of the load balancers. A scale set can reference inbound nat pools of one public and one + internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + """ + super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) + self.name = name + self.subnet = subnet + self.primary = primary + self.public_ip_address_configuration = public_ip_address_configuration + self.private_ip_address_version = private_ip_address_version + self.application_gateway_backend_address_pools = application_gateway_backend_address_pools + self.application_security_groups = application_security_groups + self.load_balancer_backend_address_pools = load_balancer_backend_address_pools + self.load_balancer_inbound_nat_pools = load_balancer_inbound_nat_pools + + +class VirtualMachineScaleSetIpTag(msrest.serialization.Model): + """Contains the IP tag associated with the public IP address. + + :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 = { + 'ip_tag_type': {'key': 'ipTagType', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_tag_type: Optional[str] = None, + 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 + + +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. + + :ivar value: Required. The list of OS upgrades performed on the virtual machine scale set. + :vartype value: + list[~azure.mgmt.compute.v2022_03_01.models.UpgradeOperationHistoricalStatusInfo] + :ivar next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + this to fetch the next page of history of upgrades. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UpgradeOperationHistoricalStatusInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["UpgradeOperationHistoricalStatusInfo"], + 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.v2022_03_01.models.UpgradeOperationHistoricalStatusInfo] + :keyword next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + this to fetch the next page of history of upgrades. + :paramtype next_link: str + """ + super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualMachineScaleSetListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSet] + :ivar next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + with this to fetch the next page of VMSS. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["VirtualMachineScaleSet"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSet] + :keyword next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call + ListNext() with this to fetch the next page of VMSS. + :paramtype next_link: str + """ + super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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. + + :ivar value: Required. The list of skus available for the virtual machine scale set. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetSku] + :ivar next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + ListNext() with this to fetch the next page of VMSS Skus. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["VirtualMachineScaleSetSku"], + 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.v2022_03_01.models.VirtualMachineScaleSetSku] + :keyword next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + ListNext() with this to fetch the next page of VMSS Skus. + :paramtype next_link: str + """ + super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): + """The List Virtual Machine operation response. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of virtual machine scale sets. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSet] + :ivar next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + with this to fetch the next page of Virtual Machine Scale Sets. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["VirtualMachineScaleSet"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of virtual machine scale sets. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSet] + :keyword next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call + ListNext() with this to fetch the next page of Virtual Machine Scale Sets. + :paramtype next_link: str + """ + super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualMachineScaleSetManagedDiskParameters(msrest.serialization.Model): + """Describes the parameters of a ScaleSet managed disk. + + :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", "PremiumV2_LRS". + :vartype storage_account_type: str or + ~azure.mgmt.compute.v2022_03_01.models.StorageAccountTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed disk. + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + :ivar security_profile: Specifies the security profile for the managed disk. + :vartype security_profile: ~azure.mgmt.compute.v2022_03_01.models.VMDiskSecurityProfile + """ + + _attribute_map = { + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + 'security_profile': {'key': 'securityProfile', 'type': 'VMDiskSecurityProfile'}, + } + + def __init__( + self, + *, + storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, + disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, + security_profile: Optional["VMDiskSecurityProfile"] = 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", "PremiumV2_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.compute.v2022_03_01.models.StorageAccountTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + :keyword security_profile: Specifies the security profile for the managed disk. + :paramtype security_profile: ~azure.mgmt.compute.v2022_03_01.models.VMDiskSecurityProfile + """ + super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) + self.storage_account_type = storage_account_type + self.disk_encryption_set = disk_encryption_set + self.security_profile = security_profile + + +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. + + :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. + :vartype primary: bool + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :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.v2022_03_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :ivar ip_configurations: Specifies the IP configurations of the network interface. + :vartype ip_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetIPConfiguration] + :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". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DeleteOptions + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, + 'enable_fpga': {'key': 'properties.enableFpga', 'type': 'bool'}, + 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetNetworkConfigurationDnsSettings'}, + 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineScaleSetIPConfiguration]'}, + 'enable_ip_forwarding': {'key': 'properties.enableIPForwarding', 'type': 'bool'}, + 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + primary: Optional[bool] = None, + enable_accelerated_networking: Optional[bool] = None, + enable_fpga: Optional[bool] = None, + network_security_group: Optional["SubResource"] = None, + dns_settings: Optional["VirtualMachineScaleSetNetworkConfigurationDnsSettings"] = None, + ip_configurations: Optional[List["VirtualMachineScaleSetIPConfiguration"]] = None, + enable_ip_forwarding: Optional[bool] = None, + 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.v2022_03_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: Specifies the IP configurations of the network interface. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DeleteOptions + """ + super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) + self.name = name + self.primary = primary + self.enable_accelerated_networking = enable_accelerated_networking + self.enable_fpga = enable_fpga + self.network_security_group = network_security_group + self.dns_settings = dns_settings + self.ip_configurations = ip_configurations + self.enable_ip_forwarding = enable_ip_forwarding + self.delete_option = delete_option + + +class VirtualMachineScaleSetNetworkConfigurationDnsSettings(msrest.serialization.Model): + """Describes a virtual machines scale sets network configuration's DNS settings. + + :ivar dns_servers: List of DNS servers IP addresses. + :vartype dns_servers: list[str] + """ + + _attribute_map = { + 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, + } + + def __init__( + self, + *, + 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 + + +class VirtualMachineScaleSetNetworkProfile(msrest.serialization.Model): + """Describes a virtual machine scale set network profile. + + :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}'. + :vartype health_probe: ~azure.mgmt.compute.v2022_03_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetNetworkConfiguration] + :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". + :vartype network_api_version: str or ~azure.mgmt.compute.v2022_03_01.models.NetworkApiVersion + """ + + _attribute_map = { + 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, + 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, + 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + health_probe: Optional["ApiEntityReference"] = None, + network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, + 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.v2022_03_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetNetworkConfiguration] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations for Virtual Machine Scale Set with + orchestration mode 'Flexible'. Possible values include: "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2022_03_01.models.NetworkApiVersion + """ + super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) + self.health_probe = health_probe + self.network_interface_configurations = network_interface_configurations + self.network_api_version = network_api_version + + +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. + + :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". + :vartype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :ivar write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :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". + :vartype create_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskCreateOptionTypes + :ivar diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + used by the virtual machine scale set. + :vartype diff_disk_settings: ~azure.mgmt.compute.v2022_03_01.models.DiffDiskSettings + :ivar disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + can be used to overwrite the size of the disk in a virtual machine image. + :code:`
    `:code:`
    ` This value cannot be larger than 1023 GB. + :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". + :vartype os_type: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemTypes + :ivar image: Specifies information about the unmanaged user image to base the scale set on. + :vartype image: ~azure.mgmt.compute.v2022_03_01.models.VirtualHardDisk + :ivar vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetManagedDiskParameters + :ivar delete_option: Specifies whether OS Disk should be deleted or detached upon VMSS Flex + deletion (This feature is available for VMSS with Flexible OrchestrationMode only). + :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is + used, the OS disk is deleted when VMSS Flex VM is deleted.:code:`
    `:code:`
    ` **Detach** + If this value is used, the OS disk is retained after VMSS Flex VM is deleted. + :code:`
    `:code:`
    ` The default value is set to **Delete**. 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". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskDeleteOptionTypes + """ + + _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'}, + 'delete_option': {'key': 'deleteOption', 'type': 'str'}, + } + + def __init__( + self, + *, + create_option: Union[str, "DiskCreateOptionTypes"], + name: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + diff_disk_settings: Optional["DiffDiskSettings"] = None, + disk_size_gb: Optional[int] = None, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + image: Optional["VirtualHardDisk"] = None, + vhd_containers: Optional[List[str]] = None, + managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, + delete_option: Optional[Union[str, "DiskDeleteOptionTypes"]] = 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.v2022_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword create_option: Required. Specifies how the virtual machines in the scale set should be + created.:code:`
    `:code:`
    ` The only allowed value is: **FromImage** \u2013 This value is + used when you are using an image to create the virtual machine. If you are using a platform + image, you also use the imageReference element described above. If you are using a marketplace + image, you also use the plan element previously described. Possible values include: + "FromImage", "Empty", "Attach". + :paramtype create_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskCreateOptionTypes + :keyword diff_disk_settings: Specifies the ephemeral disk Settings for the operating system + disk used by the virtual machine scale set. + :paramtype diff_disk_settings: ~azure.mgmt.compute.v2022_03_01.models.DiffDiskSettings + :keyword disk_size_gb: Specifies the size of the operating system disk in gigabytes. This + element can be used to overwrite the size of the disk in a virtual machine image. + :code:`
    `:code:`
    ` This value cannot be larger than 1023 GB. + :paramtype disk_size_gb: int + :keyword os_type: This property allows you to specify the type of the OS that is included in + the disk if creating a VM from user-image or a specialized VHD. :code:`
    `:code:`
    ` + Possible values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. + Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.compute.v2022_03_01.models.OperatingSystemTypes + :keyword image: Specifies information about the unmanaged user image to base the scale set on. + :paramtype image: ~azure.mgmt.compute.v2022_03_01.models.VirtualHardDisk + :keyword vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetManagedDiskParameters + :keyword delete_option: Specifies whether OS Disk should be deleted or detached upon VMSS Flex + deletion (This feature is available for VMSS with Flexible OrchestrationMode only). + :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is + used, the OS disk is deleted when VMSS Flex VM is deleted.:code:`
    `:code:`
    ` **Detach** + If this value is used, the OS disk is retained after VMSS Flex VM is deleted. + :code:`
    `:code:`
    ` The default value is set to **Delete**. 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.v2022_03_01.models.DiskDeleteOptionTypes + """ + super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) + self.name = name + self.caching = caching + self.write_accelerator_enabled = write_accelerator_enabled + self.create_option = create_option + self.diff_disk_settings = diff_disk_settings + self.disk_size_gb = disk_size_gb + self.os_type = os_type + self.image = image + self.vhd_containers = vhd_containers + self.managed_disk = managed_disk + self.delete_option = delete_option + + +class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): + """Describes a virtual machine scale set OS profile. + + :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. + :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 + :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 + `_. + :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 + `_. + :vartype custom_data: str + :ivar windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :vartype windows_configuration: ~azure.mgmt.compute.v2022_03_01.models.WindowsConfiguration + :ivar linux_configuration: Specifies the Linux operating system settings on the virtual + machine. :code:`
    `:code:`
    `For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions + `_. + :vartype linux_configuration: ~azure.mgmt.compute.v2022_03_01.models.LinuxConfiguration + :ivar secrets: Specifies set of certificates that should be installed onto the virtual machines + in the scale set. To install certificates on a virtual machine it is recommended to use the + `Azure Key Vault virtual machine extension for Linux + `_ or the `Azure + Key Vault virtual machine extension for Windows + `_. + :vartype secrets: list[~azure.mgmt.compute.v2022_03_01.models.VaultSecretGroup] + :ivar allow_extension_operations: Specifies whether extension operations should be allowed on + the virtual machine scale set. :code:`
    `:code:`
    `This may only be set to False when no + extensions are present on the virtual machine scale set. + :vartype allow_extension_operations: bool + """ + + _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]'}, + 'allow_extension_operations': {'key': 'allowExtensionOperations', 'type': 'bool'}, + } + + def __init__( + self, + *, + computer_name_prefix: Optional[str] = None, + admin_username: Optional[str] = None, + admin_password: Optional[str] = None, + custom_data: Optional[str] = None, + windows_configuration: Optional["WindowsConfiguration"] = None, + linux_configuration: Optional["LinuxConfiguration"] = None, + secrets: Optional[List["VaultSecretGroup"]] = None, + allow_extension_operations: Optional[bool] = 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.v2022_03_01.models.WindowsConfiguration + :keyword linux_configuration: Specifies the Linux operating system settings on the virtual + machine. :code:`
    `:code:`
    `For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions + `_. + :paramtype linux_configuration: ~azure.mgmt.compute.v2022_03_01.models.LinuxConfiguration + :keyword secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. To install certificates on a virtual machine it is recommended to + use the `Azure Key Vault virtual machine extension for Linux + `_ or the `Azure + Key Vault virtual machine extension for Windows + `_. + :paramtype secrets: list[~azure.mgmt.compute.v2022_03_01.models.VaultSecretGroup] + :keyword allow_extension_operations: Specifies whether extension operations should be allowed + on the virtual machine scale set. :code:`
    `:code:`
    `This may only be set to False when no + extensions are present on the virtual machine scale set. + :paramtype allow_extension_operations: bool + """ + super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) + self.computer_name_prefix = computer_name_prefix + self.admin_username = admin_username + self.admin_password = admin_password + self.custom_data = custom_data + self.windows_configuration = windows_configuration + self.linux_configuration = linux_configuration + self.secrets = secrets + self.allow_extension_operations = allow_extension_operations + + +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. + + :ivar name: Required. The publicIP address configuration name. + :vartype name: str + :ivar sku: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible. + :vartype sku: ~azure.mgmt.compute.v2022_03_01.models.PublicIPAddressSku + :ivar idle_timeout_in_minutes: The idle timeout of the public IP address. + :vartype idle_timeout_in_minutes: int + :ivar dns_settings: The dns settings to be applied on the publicIP addresses . + :vartype dns_settings: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :ivar ip_tags: The list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetIpTag] + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values + are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :vartype public_ip_address_version: str or ~azure.mgmt.compute.v2022_03_01.models.IPVersion + :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Possible + values include: "Delete", "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DeleteOptions + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'PublicIPAddressSku'}, + 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings'}, + 'ip_tags': {'key': 'properties.ipTags', 'type': '[VirtualMachineScaleSetIpTag]'}, + 'public_ip_prefix': {'key': 'properties.publicIPPrefix', 'type': 'SubResource'}, + 'public_ip_address_version': {'key': 'properties.publicIPAddressVersion', 'type': 'str'}, + 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + sku: Optional["PublicIPAddressSku"] = None, + idle_timeout_in_minutes: Optional[int] = None, + dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, + ip_tags: Optional[List["VirtualMachineScaleSetIpTag"]] = None, + public_ip_prefix: Optional["SubResource"] = None, + public_ip_address_version: Optional[Union[str, "IPVersion"]] = None, + 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. It can only be set with OrchestrationMode as + Flexible. + :paramtype sku: ~azure.mgmt.compute.v2022_03_01.models.PublicIPAddressSku + :keyword idle_timeout_in_minutes: The idle timeout of the public IP address. + :paramtype idle_timeout_in_minutes: int + :keyword dns_settings: The dns settings to be applied on the publicIP addresses . + :paramtype dns_settings: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword ip_tags: The list of IP tags associated with the public IP address. + :paramtype ip_tags: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetIpTag] + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it + represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + Possible values are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :paramtype public_ip_address_version: str or ~azure.mgmt.compute.v2022_03_01.models.IPVersion + :keyword delete_option: Specify what happens to the public IP when the VM is deleted. Possible + values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DeleteOptions + """ + super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) + self.name = name + self.sku = sku + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.dns_settings = dns_settings + self.ip_tags = ip_tags + self.public_ip_prefix = public_ip_prefix + self.public_ip_address_version = public_ip_address_version + self.delete_option = delete_option + + +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. + + :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. + :vartype domain_name_label: str + """ + + _validation = { + 'domain_name_label': {'required': True}, + } + + _attribute_map = { + 'domain_name_label': {'key': 'domainNameLabel', 'type': 'str'}, + } + + def __init__( + self, + *, + 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 + + +class VirtualMachineScaleSetVMReimageParameters(VirtualMachineReimageParameters): + """Describes a Virtual Machine Scale Set VM Reimage Parameters. + + :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. + :vartype temp_disk: bool + """ + + _attribute_map = { + 'temp_disk': {'key': 'tempDisk', 'type': 'bool'}, + } + + def __init__( + self, + *, + 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. + + :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. + :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. + :vartype instance_ids: list[str] + """ + + _attribute_map = { + 'temp_disk': {'key': 'tempDisk', 'type': 'bool'}, + 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, + } + + def __init__( + self, + *, + temp_disk: Optional[bool] = None, + 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 + + +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.v2022_03_01.models.Sku + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetSkuCapacity + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'sku': {'readonly': True}, + 'capacity': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'capacity': {'key': 'capacity', 'type': 'VirtualMachineScaleSetSkuCapacity'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualMachineScaleSetSku, self).__init__(**kwargs) + self.resource_type = None + self.sku = None + self.capacity = None + + +class VirtualMachineScaleSetSkuCapacity(msrest.serialization.Model): + """Describes scaling information of a sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar minimum: The minimum capacity. + :vartype minimum: long + :ivar maximum: The maximum capacity that can be set. + :vartype maximum: long + :ivar default_capacity: The default capacity. + :vartype default_capacity: long + :ivar scale_type: The scale type applicable to the sku. Possible values include: "Automatic", + "None". + :vartype scale_type: str or + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetSkuScaleType + """ + + _validation = { + 'minimum': {'readonly': True}, + 'maximum': {'readonly': True}, + 'default_capacity': {'readonly': True}, + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'long'}, + 'maximum': {'key': 'maximum', 'type': 'long'}, + 'default_capacity': {'key': 'defaultCapacity', 'type': 'long'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default_capacity = None + self.scale_type = None + + +class VirtualMachineScaleSetStorageProfile(msrest.serialization.Model): + """Describes a virtual machine scale set storage profile. + + :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. + :vartype image_reference: ~azure.mgmt.compute.v2022_03_01.models.ImageReference + :ivar os_disk: Specifies information about the operating system disk used by the virtual + machines in the scale set. :code:`
    `:code:`
    ` For more information about disks, see + `About disks and VHDs for Azure virtual machines + `_. + :vartype os_disk: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetOSDisk + :ivar data_disks: Specifies the parameters that are used to add data disks to the virtual + machines in the scale set. :code:`
    `:code:`
    ` For more information about disks, see + `About disks and VHDs for Azure virtual machines + `_. + :vartype data_disks: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetDataDisk] + """ + + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'VirtualMachineScaleSetOSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[VirtualMachineScaleSetDataDisk]'}, + } + + def __init__( + self, + *, + image_reference: Optional["ImageReference"] = None, + os_disk: Optional["VirtualMachineScaleSetOSDisk"] = None, + 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.v2022_03_01.models.ImageReference + :keyword os_disk: Specifies information about the operating system disk used by the virtual + machines in the scale set. :code:`
    `:code:`
    ` For more information about disks, see + `About disks and VHDs for Azure virtual machines + `_. + :paramtype os_disk: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetOSDisk + :keyword data_disks: Specifies the parameters that are used to add data disks to the virtual + machines in the scale set. :code:`
    `:code:`
    ` For more information about disks, see + `About disks and VHDs for Azure virtual machines + `_. + :paramtype data_disks: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetDataDisk] + """ + super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) + self.image_reference = image_reference + self.os_disk = os_disk + self.data_disks = data_disks + + +class VirtualMachineScaleSetUpdate(UpdateResource): + """Describes a Virtual Machine Scale Set. + + :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.v2022_03_01.models.Sku + :ivar plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :vartype plan: ~azure.mgmt.compute.v2022_03_01.models.Plan + :ivar identity: The identity of the virtual machine scale set, if configured. + :vartype identity: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetIdentity + :ivar upgrade_policy: The upgrade policy. + :vartype upgrade_policy: ~azure.mgmt.compute.v2022_03_01.models.UpgradePolicy + :ivar automatic_repairs_policy: Policy for automatic repairs. + :vartype automatic_repairs_policy: + ~azure.mgmt.compute.v2022_03_01.models.AutomaticRepairsPolicy + :ivar virtual_machine_profile: The virtual machine profile. + :vartype virtual_machine_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateVMProfile + :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. + :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. + :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. + :vartype additional_capabilities: ~azure.mgmt.compute.v2022_03_01.models.AdditionalCapabilities + :ivar scale_in_policy: Specifies the policies applied when scaling in Virtual Machines in the + Virtual Machine Scale Set. + :vartype scale_in_policy: ~azure.mgmt.compute.v2022_03_01.models.ScaleInPolicy + :ivar proximity_placement_group: Specifies information about the proximity placement group that + the virtual machine scale set should be assigned to. :code:`
    `:code:`
    `Minimum + api-version: 2018-04-01. + :vartype proximity_placement_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'identity': {'key': 'identity', 'type': 'VirtualMachineScaleSetIdentity'}, + 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, + 'automatic_repairs_policy': {'key': 'properties.automaticRepairsPolicy', 'type': 'AutomaticRepairsPolicy'}, + 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetUpdateVMProfile'}, + 'overprovision': {'key': 'properties.overprovision', 'type': 'bool'}, + 'do_not_run_extensions_on_overprovisioned_v_ms': {'key': 'properties.doNotRunExtensionsOnOverprovisionedVMs', 'type': 'bool'}, + 'single_placement_group': {'key': 'properties.singlePlacementGroup', 'type': 'bool'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'scale_in_policy': {'key': 'properties.scaleInPolicy', 'type': 'ScaleInPolicy'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + plan: Optional["Plan"] = None, + identity: Optional["VirtualMachineScaleSetIdentity"] = None, + upgrade_policy: Optional["UpgradePolicy"] = None, + automatic_repairs_policy: Optional["AutomaticRepairsPolicy"] = None, + virtual_machine_profile: Optional["VirtualMachineScaleSetUpdateVMProfile"] = None, + overprovision: Optional[bool] = None, + do_not_run_extensions_on_overprovisioned_v_ms: Optional[bool] = None, + single_placement_group: Optional[bool] = None, + additional_capabilities: Optional["AdditionalCapabilities"] = None, + scale_in_policy: Optional["ScaleInPolicy"] = None, + proximity_placement_group: Optional["SubResource"] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.Sku + :keyword plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :paramtype plan: ~azure.mgmt.compute.v2022_03_01.models.Plan + :keyword identity: The identity of the virtual machine scale set, if configured. + :paramtype identity: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetIdentity + :keyword upgrade_policy: The upgrade policy. + :paramtype upgrade_policy: ~azure.mgmt.compute.v2022_03_01.models.UpgradePolicy + :keyword automatic_repairs_policy: Policy for automatic repairs. + :paramtype automatic_repairs_policy: + ~azure.mgmt.compute.v2022_03_01.models.AutomaticRepairsPolicy + :keyword virtual_machine_profile: The virtual machine profile. + :paramtype virtual_machine_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateVMProfile + :keyword overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :paramtype overprovision: bool + :keyword do_not_run_extensions_on_overprovisioned_v_ms: When Overprovision is enabled, + extensions are launched only on the requested number of VMs which are finally kept. This + property will hence ensure that the extensions do not run on the extra overprovisioned VMs. + :paramtype do_not_run_extensions_on_overprovisioned_v_ms: bool + :keyword single_placement_group: When true this limits the scale set to a single placement + group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be + modified to false. However, if singlePlacementGroup is false, it may not be modified to true. + :paramtype single_placement_group: bool + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines + have the capability to support attaching managed data disks with UltraSSD_LRS storage account + type. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.ScaleInPolicy + :keyword proximity_placement_group: Specifies information about the proximity placement group + that the virtual machine scale set should be assigned to. :code:`
    `:code:`
    `Minimum + api-version: 2018-04-01. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + """ + super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) + self.sku = sku + self.plan = plan + self.identity = identity + self.upgrade_policy = upgrade_policy + self.automatic_repairs_policy = automatic_repairs_policy + self.virtual_machine_profile = virtual_machine_profile + self.overprovision = overprovision + self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms + self.single_placement_group = single_placement_group + self.additional_capabilities = additional_capabilities + self.scale_in_policy = scale_in_policy + self.proximity_placement_group = proximity_placement_group + + +class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): + """Describes a virtual machine scale set network profile's IP configuration. NOTE: The subnet of a scale set may be modified as long as the original subnet and the new subnet are in the same virtual network. + + :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.v2022_03_01.models.ApiEntityReference + :ivar primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :vartype primary: bool + :ivar public_ip_address_configuration: The publicIPAddressConfiguration. + :vartype public_ip_address_configuration: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :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". + :vartype private_ip_address_version: str or ~azure.mgmt.compute.v2022_03_01.models.IPVersion + :ivar application_gateway_backend_address_pools: The application gateway backend address pools. + :vartype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :ivar application_security_groups: Specifies an array of references to application security + group. + :vartype application_security_groups: list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :ivar load_balancer_backend_address_pools: The load balancer backend address pools. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :ivar load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :vartype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subnet': {'key': 'properties.subnet', 'type': 'ApiEntityReference'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'public_ip_address_configuration': {'key': 'properties.publicIPAddressConfiguration', 'type': 'VirtualMachineScaleSetUpdatePublicIPAddressConfiguration'}, + 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, + 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', 'type': '[SubResource]'}, + 'application_security_groups': {'key': 'properties.applicationSecurityGroups', 'type': '[SubResource]'}, + 'load_balancer_backend_address_pools': {'key': 'properties.loadBalancerBackendAddressPools', 'type': '[SubResource]'}, + 'load_balancer_inbound_nat_pools': {'key': 'properties.loadBalancerInboundNatPools', 'type': '[SubResource]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + subnet: Optional["ApiEntityReference"] = None, + primary: Optional[bool] = None, + public_ip_address_configuration: Optional["VirtualMachineScaleSetUpdatePublicIPAddressConfiguration"] = None, + private_ip_address_version: Optional[Union[str, "IPVersion"]] = None, + application_gateway_backend_address_pools: Optional[List["SubResource"]] = None, + application_security_groups: Optional[List["SubResource"]] = None, + load_balancer_backend_address_pools: Optional[List["SubResource"]] = None, + load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.ApiEntityReference + :keyword primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :paramtype primary: bool + :keyword public_ip_address_configuration: The publicIPAddressConfiguration. + :paramtype public_ip_address_configuration: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :keyword private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it + represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + Possible values are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :paramtype private_ip_address_version: str or ~azure.mgmt.compute.v2022_03_01.models.IPVersion + :keyword application_gateway_backend_address_pools: The application gateway backend address + pools. + :paramtype application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :keyword application_security_groups: Specifies an array of references to application security + group. + :paramtype application_security_groups: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :keyword load_balancer_backend_address_pools: The load balancer backend address pools. + :paramtype load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + :keyword load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :paramtype load_balancer_inbound_nat_pools: + list[~azure.mgmt.compute.v2022_03_01.models.SubResource] + """ + super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) + self.name = name + self.subnet = subnet + self.primary = primary + self.public_ip_address_configuration = public_ip_address_configuration + self.private_ip_address_version = private_ip_address_version + self.application_gateway_backend_address_pools = application_gateway_backend_address_pools + self.application_security_groups = application_security_groups + self.load_balancer_backend_address_pools = load_balancer_backend_address_pools + self.load_balancer_inbound_nat_pools = load_balancer_inbound_nat_pools + + +class VirtualMachineScaleSetUpdateNetworkConfiguration(SubResource): + """Describes a virtual machine scale set network profile's network configurations. + + :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. + :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.v2022_03_01.models.SubResource + :ivar dns_settings: The dns settings to be applied on the network interfaces. + :vartype dns_settings: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :ivar ip_configurations: The virtual machine scale set IP Configuration. + :vartype ip_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :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". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DeleteOptions + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, + 'enable_fpga': {'key': 'properties.enableFpga', 'type': 'bool'}, + 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetNetworkConfigurationDnsSettings'}, + 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineScaleSetUpdateIPConfiguration]'}, + 'enable_ip_forwarding': {'key': 'properties.enableIPForwarding', 'type': 'bool'}, + 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + primary: Optional[bool] = None, + enable_accelerated_networking: Optional[bool] = None, + enable_fpga: Optional[bool] = None, + network_security_group: Optional["SubResource"] = None, + dns_settings: Optional["VirtualMachineScaleSetNetworkConfigurationDnsSettings"] = None, + ip_configurations: Optional[List["VirtualMachineScaleSetUpdateIPConfiguration"]] = None, + enable_ip_forwarding: Optional[bool] = None, + 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.v2022_03_01.models.SubResource + :keyword dns_settings: The dns settings to be applied on the network interfaces. + :paramtype dns_settings: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :keyword ip_configurations: The virtual machine scale set IP Configuration. + :paramtype ip_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :keyword enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :paramtype enable_ip_forwarding: bool + :keyword delete_option: Specify what happens to the network interface when the VM is deleted. + Possible values include: "Delete", "Detach". + :paramtype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DeleteOptions + """ + super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) + self.name = name + self.primary = primary + self.enable_accelerated_networking = enable_accelerated_networking + self.enable_fpga = enable_fpga + self.network_security_group = network_security_group + self.dns_settings = dns_settings + self.ip_configurations = ip_configurations + self.enable_ip_forwarding = enable_ip_forwarding + self.delete_option = delete_option + + +class VirtualMachineScaleSetUpdateNetworkProfile(msrest.serialization.Model): + """Describes a virtual machine scale set network profile. + + :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}'. + :vartype health_probe: ~azure.mgmt.compute.v2022_03_01.models.ApiEntityReference + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + :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". + :vartype network_api_version: str or ~azure.mgmt.compute.v2022_03_01.models.NetworkApiVersion + """ + + _attribute_map = { + 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, + 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetUpdateNetworkConfiguration]'}, + 'network_api_version': {'key': 'networkApiVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + health_probe: Optional["ApiEntityReference"] = None, + network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, + 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.v2022_03_01.models.ApiEntityReference + :keyword network_interface_configurations: The list of network configurations. + :paramtype network_interface_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + :keyword network_api_version: specifies the Microsoft.Network API version used when creating + networking resources in the Network Interface Configurations for Virtual Machine Scale Set with + orchestration mode 'Flexible'. Possible values include: "2020-11-01". + :paramtype network_api_version: str or ~azure.mgmt.compute.v2022_03_01.models.NetworkApiVersion + """ + super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) + self.health_probe = health_probe + self.network_interface_configurations = network_interface_configurations + self.network_api_version = network_api_version + + +class VirtualMachineScaleSetUpdateOSDisk(msrest.serialization.Model): + """Describes virtual machine scale set operating system disk Update Object. This should be used for Updating VMSS OS Disk. + + :ivar caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :vartype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :ivar write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :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. + :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. + :vartype image: ~azure.mgmt.compute.v2022_03_01.models.VirtualHardDisk + :ivar vhd_containers: The list of virtual hard disk container uris. + :vartype vhd_containers: list[str] + :ivar managed_disk: The managed disk parameters. + :vartype managed_disk: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetManagedDiskParameters + :ivar delete_option: Specifies whether OS Disk should be deleted or detached upon VMSS Flex + deletion (This feature is available for VMSS with Flexible OrchestrationMode only). + :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is + used, the OS disk is deleted when VMSS Flex VM is deleted.:code:`
    `:code:`
    ` **Detach** + If this value is used, the OS disk is retained after VMSS Flex VM is deleted. + :code:`
    `:code:`
    ` The default value is set to **Delete**. 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". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DiskDeleteOptionTypes + """ + + _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'}, + 'delete_option': {'key': 'deleteOption', 'type': 'str'}, + } + + def __init__( + self, + *, + caching: Optional[Union[str, "CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + disk_size_gb: Optional[int] = None, + image: Optional["VirtualHardDisk"] = None, + vhd_containers: Optional[List[str]] = None, + managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, + delete_option: Optional[Union[str, "DiskDeleteOptionTypes"]] = None, + **kwargs + ): + """ + :keyword caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :paramtype caching: str or ~azure.mgmt.compute.v2022_03_01.models.CachingTypes + :keyword write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :paramtype write_accelerator_enabled: bool + :keyword disk_size_gb: Specifies the size of the operating system disk in gigabytes. This + element can be used to overwrite the size of the disk in a virtual machine image. + :code:`
    `:code:`
    ` This value cannot be larger than 1023 GB. + :paramtype disk_size_gb: int + :keyword image: The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied + before using it to attach to the Virtual Machine. If SourceImage is provided, the destination + VirtualHardDisk should not exist. + :paramtype image: ~azure.mgmt.compute.v2022_03_01.models.VirtualHardDisk + :keyword vhd_containers: The list of virtual hard disk container uris. + :paramtype vhd_containers: list[str] + :keyword managed_disk: The managed disk parameters. + :paramtype managed_disk: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetManagedDiskParameters + :keyword delete_option: Specifies whether OS Disk should be deleted or detached upon VMSS Flex + deletion (This feature is available for VMSS with Flexible OrchestrationMode only). + :code:`
    `:code:`
    ` Possible values: :code:`
    `:code:`
    ` **Delete** If this value is + used, the OS disk is deleted when VMSS Flex VM is deleted.:code:`
    `:code:`
    ` **Detach** + If this value is used, the OS disk is retained after VMSS Flex VM is deleted. + :code:`
    `:code:`
    ` The default value is set to **Delete**. 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.v2022_03_01.models.DiskDeleteOptionTypes + """ + super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) + self.caching = caching + self.write_accelerator_enabled = write_accelerator_enabled + self.disk_size_gb = disk_size_gb + self.image = image + self.vhd_containers = vhd_containers + self.managed_disk = managed_disk + self.delete_option = delete_option + + +class VirtualMachineScaleSetUpdateOSProfile(msrest.serialization.Model): + """Describes a virtual machine scale set OS profile. + + :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.v2022_03_01.models.WindowsConfiguration + :ivar linux_configuration: The Linux Configuration of the OS profile. + :vartype linux_configuration: ~azure.mgmt.compute.v2022_03_01.models.LinuxConfiguration + :ivar secrets: The List of certificates for addition to the VM. + :vartype secrets: list[~azure.mgmt.compute.v2022_03_01.models.VaultSecretGroup] + """ + + _attribute_map = { + 'custom_data': {'key': 'customData', 'type': 'str'}, + 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'WindowsConfiguration'}, + 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'LinuxConfiguration'}, + 'secrets': {'key': 'secrets', 'type': '[VaultSecretGroup]'}, + } + + def __init__( + self, + *, + custom_data: Optional[str] = None, + windows_configuration: Optional["WindowsConfiguration"] = None, + linux_configuration: Optional["LinuxConfiguration"] = None, + 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.v2022_03_01.models.WindowsConfiguration + :keyword linux_configuration: The Linux Configuration of the OS profile. + :paramtype linux_configuration: ~azure.mgmt.compute.v2022_03_01.models.LinuxConfiguration + :keyword secrets: The List of certificates for addition to the VM. + :paramtype secrets: list[~azure.mgmt.compute.v2022_03_01.models.VaultSecretGroup] + """ + super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) + self.custom_data = custom_data + self.windows_configuration = windows_configuration + self.linux_configuration = linux_configuration + self.secrets = secrets + + +class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(msrest.serialization.Model): + """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. + + :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.v2022_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :ivar public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :vartype public_ip_prefix: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar delete_option: Specify what happens to the public IP when the VM is deleted. Possible + values include: "Delete", "Detach". + :vartype delete_option: str or ~azure.mgmt.compute.v2022_03_01.models.DeleteOptions + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings'}, + 'public_ip_prefix': {'key': 'properties.publicIPPrefix', 'type': 'SubResource'}, + 'delete_option': {'key': 'properties.deleteOption', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + idle_timeout_in_minutes: Optional[int] = None, + dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, + public_ip_prefix: Optional["SubResource"] = None, + 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.v2022_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :keyword public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :paramtype public_ip_prefix: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :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.v2022_03_01.models.DeleteOptions + """ + super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) + self.name = name + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.dns_settings = dns_settings + self.public_ip_prefix = public_ip_prefix + self.delete_option = delete_option + + +class VirtualMachineScaleSetUpdateStorageProfile(msrest.serialization.Model): + """Describes a virtual machine scale set storage profile. + + :ivar image_reference: The image reference. + :vartype image_reference: ~azure.mgmt.compute.v2022_03_01.models.ImageReference + :ivar os_disk: The OS disk. + :vartype os_disk: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateOSDisk + :ivar data_disks: The data disks. + :vartype data_disks: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetDataDisk] + """ + + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'VirtualMachineScaleSetUpdateOSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[VirtualMachineScaleSetDataDisk]'}, + } + + def __init__( + self, + *, + image_reference: Optional["ImageReference"] = None, + os_disk: Optional["VirtualMachineScaleSetUpdateOSDisk"] = None, + data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, + **kwargs + ): + """ + :keyword image_reference: The image reference. + :paramtype image_reference: ~azure.mgmt.compute.v2022_03_01.models.ImageReference + :keyword os_disk: The OS disk. + :paramtype os_disk: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateOSDisk + :keyword data_disks: The data disks. + :paramtype data_disks: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetDataDisk] + """ + super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) + self.image_reference = image_reference + self.os_disk = os_disk + self.data_disks = data_disks + + +class VirtualMachineScaleSetUpdateVMProfile(msrest.serialization.Model): + """Describes a virtual machine scale set virtual machine profile. + + :ivar os_profile: The virtual machine scale set OS profile. + :vartype os_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateOSProfile + :ivar storage_profile: The virtual machine scale set storage profile. + :vartype storage_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateStorageProfile + :ivar network_profile: The virtual machine scale set network profile. + :vartype network_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :ivar security_profile: The virtual machine scale set Security profile. + :vartype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :ivar diagnostics_profile: The virtual machine scale set diagnostics profile. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :ivar extension_profile: The virtual machine scale set extension profile. + :vartype extension_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtensionProfile + :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. + :vartype billing_profile: ~azure.mgmt.compute.v2022_03_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2022_03_01.models.ScheduledEventsProfile + :ivar user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :vartype 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, + *, + os_profile: Optional["VirtualMachineScaleSetUpdateOSProfile"] = None, + storage_profile: Optional["VirtualMachineScaleSetUpdateStorageProfile"] = None, + network_profile: Optional["VirtualMachineScaleSetUpdateNetworkProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + diagnostics_profile: Optional["DiagnosticsProfile"] = None, + extension_profile: Optional["VirtualMachineScaleSetExtensionProfile"] = None, + license_type: Optional[str] = None, + billing_profile: Optional["BillingProfile"] = None, + scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, + user_data: Optional[str] = None, + **kwargs + ): + """ + :keyword os_profile: The virtual machine scale set OS profile. + :paramtype os_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateOSProfile + :keyword storage_profile: The virtual machine scale set storage profile. + :paramtype storage_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateStorageProfile + :keyword network_profile: The virtual machine scale set network profile. + :paramtype network_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :keyword security_profile: The virtual machine scale set Security profile. + :paramtype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :keyword diagnostics_profile: The virtual machine scale set diagnostics profile. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :keyword extension_profile: The virtual machine scale set extension profile. + :paramtype extension_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: The license type, which is for bring your own license scenario. + :paramtype license_type: str + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2022_03_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2022_03_01.models.ScheduledEventsProfile + :keyword user_data: UserData for the VM, which must be base-64 encoded. Customer should not + pass any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :paramtype user_data: str + """ + super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) + self.os_profile = os_profile + self.storage_profile = storage_profile + self.network_profile = network_profile + self.security_profile = security_profile + self.diagnostics_profile = diagnostics_profile + self.extension_profile = extension_profile + self.license_type = license_type + self.billing_profile = billing_profile + self.scheduled_events_profile = scheduled_events_profile + self.user_data = user_data + + +class 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 + :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.v2022_03_01.models.Sku + :ivar plan: Specifies information about the marketplace image used to create the virtual + machine. This element is only used for marketplace images. Before you can use a marketplace + image from an API, you must enable the image for programmatic use. In the Azure portal, find + the marketplace image that you want to use and then click **Want to deploy programmatically, + Get Started ->**. Enter any required information and then click **Save**. + :vartype plan: ~azure.mgmt.compute.v2022_03_01.models.Plan + :ivar resources: The virtual machine child extension resources. + :vartype resources: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtension] + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineIdentity + :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.v2022_03_01.models.VirtualMachineScaleSetVMInstanceView + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2022_03_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2022_03_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine in the scale set. For instance: whether the virtual machine has the capability + to support attaching managed data disks with UltraSSD_LRS storage account type. + :vartype additional_capabilities: ~azure.mgmt.compute.v2022_03_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings for the virtual machine. + :vartype os_profile: ~azure.mgmt.compute.v2022_03_01.models.OSProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual + machine. + :vartype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2022_03_01.models.NetworkProfile + :ivar network_profile_configuration: Specifies the network profile configuration of the virtual + machine. + :vartype network_profile_configuration: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :ivar availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Availability sets overview + `_. + :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. + :vartype availability_set: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar license_type: Specifies that the image or disk that is being used was licensed + on-premises. :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. + :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 + :ivar protection_policy: Specifies the protection policy of the virtual machine. + :vartype protection_policy: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMProtectionPolicy + :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. + :vartype 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]'}, + 'identity': {'key': 'identity', 'type': 'VirtualMachineIdentity'}, + 'latest_model_applied': {'key': 'properties.latestModelApplied', 'type': 'bool'}, + 'vm_id': {'key': 'properties.vmId', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineScaleSetVMInstanceView'}, + 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'SecurityProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'network_profile_configuration': {'key': 'properties.networkProfileConfiguration', 'type': 'VirtualMachineScaleSetVMNetworkProfileConfiguration'}, + 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, + 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + 'model_definition_applied': {'key': 'properties.modelDefinitionApplied', 'type': 'str'}, + 'protection_policy': {'key': 'properties.protectionPolicy', 'type': 'VirtualMachineScaleSetVMProtectionPolicy'}, + 'user_data': {'key': 'properties.userData', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + identity: Optional["VirtualMachineIdentity"] = None, + hardware_profile: Optional["HardwareProfile"] = None, + storage_profile: Optional["StorageProfile"] = None, + additional_capabilities: Optional["AdditionalCapabilities"] = None, + os_profile: Optional["OSProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + network_profile: Optional["NetworkProfile"] = None, + network_profile_configuration: Optional["VirtualMachineScaleSetVMNetworkProfileConfiguration"] = None, + diagnostics_profile: Optional["DiagnosticsProfile"] = None, + availability_set: Optional["SubResource"] = None, + license_type: Optional[str] = None, + protection_policy: Optional["VirtualMachineScaleSetVMProtectionPolicy"] = None, + user_data: Optional[str] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineIdentity + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2022_03_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2022_03_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine in the scale set. For instance: whether the virtual machine has the capability + to support attaching managed data disks with UltraSSD_LRS storage account type. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2022_03_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings for the virtual machine. + :paramtype os_profile: ~azure.mgmt.compute.v2022_03_01.models.OSProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2022_03_01.models.NetworkProfile + :keyword network_profile_configuration: Specifies the network profile configuration of the + virtual machine. + :paramtype network_profile_configuration: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :keyword availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates for Virtual Machines in Azure + `_ + :code:`
    `:code:`
    ` Currently, a VM can only be added to availability set at creation + time. An existing VM cannot be added to an availability set. + :paramtype availability_set: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword protection_policy: Specifies the protection policy of the virtual machine. + :paramtype protection_policy: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMProtectionPolicy + :keyword user_data: UserData for the VM, which must be base-64 encoded. Customer should not + pass any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :paramtype user_data: str + """ + super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) + self.instance_id = None + self.sku = None + self.plan = plan + self.resources = None + self.zones = None + self.identity = identity + self.latest_model_applied = None + self.vm_id = None + self.instance_view = None + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.additional_capabilities = additional_capabilities + self.os_profile = os_profile + self.security_profile = security_profile + self.network_profile = network_profile + self.network_profile_configuration = network_profile_configuration + self.diagnostics_profile = diagnostics_profile + self.availability_set = availability_set + self.provisioning_state = None + self.license_type = license_type + self.model_definition_applied = None + self.protection_policy = protection_policy + self.user_data = user_data + + +class 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 + :ivar force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :vartype auto_upgrade_minor_version: bool + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :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. + :vartype protected_settings: any + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine extension instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2022_03_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. + :vartype suppress_failures: bool + :ivar protected_settings_from_key_vault: The extensions protected settings that are passed by + reference, and consumed from key vault. + :vartype protected_settings_from_key_vault: any + """ + + _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'}, + 'protected_settings_from_key_vault': {'key': 'properties.protectedSettingsFromKeyVault', 'type': 'object'}, + } + + def __init__( + self, + *, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type_properties_type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, + instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, + suppress_failures: Optional[bool] = None, + protected_settings_from_key_vault: Optional[Any] = None, + **kwargs + ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword instance_view: The virtual machine extension instance view. + :paramtype instance_view: + ~azure.mgmt.compute.v2022_03_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 + :keyword protected_settings_from_key_vault: The extensions protected settings that are passed + by reference, and consumed from key vault. + :paramtype protected_settings_from_key_vault: any + """ + super(VirtualMachineScaleSetVMExtension, self).__init__(**kwargs) + self.name = None + self.type = None + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type_properties_type = type_properties_type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings + self.provisioning_state = None + self.instance_view = instance_view + self.suppress_failures = suppress_failures + self.protected_settings_from_key_vault = protected_settings_from_key_vault + + +class VirtualMachineScaleSetVMExtensionsListResult(msrest.serialization.Model): + """The List VMSS VM Extension operation response. + + :ivar value: The list of VMSS VM extensions. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVMExtension]'}, + } + + def __init__( + self, + *, + value: Optional[List["VirtualMachineScaleSetVMExtension"]] = None, + **kwargs + ): + """ + :keyword value: The list of VMSS VM extensions. + :paramtype value: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMExtension] + """ + super(VirtualMachineScaleSetVMExtensionsListResult, self).__init__(**kwargs) + self.value = value + + +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.v2022_03_01.models.VirtualMachineStatusCodeCount] + """ + + _validation = { + 'name': {'readonly': True}, + 'statuses_summary': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'statuses_summary': {'key': 'statusesSummary', 'type': '[VirtualMachineStatusCodeCount]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) + self.name = None + self.statuses_summary = None + + +class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): + """Describes a VMSS VM Extension. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: The name of the extension. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :vartype type_properties_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :vartype auto_upgrade_minor_version: bool + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :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. + :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. + :vartype suppress_failures: bool + :ivar protected_settings_from_key_vault: The extensions protected settings that are passed by + reference, and consumed from key vault. + :vartype protected_settings_from_key_vault: any + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + 'suppress_failures': {'key': 'properties.suppressFailures', 'type': 'bool'}, + 'protected_settings_from_key_vault': {'key': 'properties.protectedSettingsFromKeyVault', 'type': 'object'}, + } + + def __init__( + self, + *, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type_properties_type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, + suppress_failures: Optional[bool] = None, + protected_settings_from_key_vault: Optional[Any] = None, + **kwargs + ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type_properties_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :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 + :keyword protected_settings_from_key_vault: The extensions protected settings that are passed + by reference, and consumed from key vault. + :paramtype protected_settings_from_key_vault: any + """ + super(VirtualMachineScaleSetVMExtensionUpdate, self).__init__(**kwargs) + self.name = None + self.type = None + self.force_update_tag = force_update_tag + self.publisher = publisher + self.type_properties_type = type_properties_type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings + self.suppress_failures = suppress_failures + self.protected_settings_from_key_vault = protected_settings_from_key_vault + + +class VirtualMachineScaleSetVMInstanceIDs(msrest.serialization.Model): + """Specifies a list of virtual machine instance IDs from the VM scale set. + + :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. + :vartype instance_ids: list[str] + """ + + _attribute_map = { + 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, + } + + def __init__( + self, + *, + 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 + + +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. + + :ivar instance_ids: Required. The virtual machine scale set instance ids. + :vartype instance_ids: list[str] + """ + + _validation = { + 'instance_ids': {'required': True}, + } + + _attribute_map = { + 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, + } + + def __init__( + self, + *, + 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 + + +class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine scale set VM. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar 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.v2022_03_01.models.VirtualMachineAgentInstanceView + :ivar maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :vartype maintenance_redeploy_status: + ~azure.mgmt.compute.v2022_03_01.models.MaintenanceRedeployStatus + :ivar disks: The disks information. + :vartype disks: list[~azure.mgmt.compute.v2022_03_01.models.DiskInstanceView] + :ivar extensions: The extensions information. + :vartype extensions: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionInstanceView] + :ivar vm_health: The health status for the VM. + :vartype vm_health: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineHealthStatus + :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. + :vartype boot_diagnostics: ~azure.mgmt.compute.v2022_03_01.models.BootDiagnosticsInstanceView + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + :ivar assigned_host: Resource id of the dedicated host, on which the virtual machine is + allocated through automatic placement, when the virtual machine is associated with a dedicated + host group that has automatic placement enabled. :code:`
    `:code:`
    `Minimum api-version: + 2020-06-01. + :vartype assigned_host: str + :ivar placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :vartype 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, + *, + platform_update_domain: Optional[int] = None, + platform_fault_domain: Optional[int] = None, + rdp_thumb_print: Optional[str] = None, + vm_agent: Optional["VirtualMachineAgentInstanceView"] = None, + maintenance_redeploy_status: Optional["MaintenanceRedeployStatus"] = None, + disks: Optional[List["DiskInstanceView"]] = None, + extensions: Optional[List["VirtualMachineExtensionInstanceView"]] = None, + boot_diagnostics: Optional["BootDiagnosticsInstanceView"] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + placement_group_id: Optional[str] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.VirtualMachineAgentInstanceView + :keyword maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :paramtype maintenance_redeploy_status: + ~azure.mgmt.compute.v2022_03_01.models.MaintenanceRedeployStatus + :keyword disks: The disks information. + :paramtype disks: list[~azure.mgmt.compute.v2022_03_01.models.DiskInstanceView] + :keyword extensions: The extensions information. + :paramtype extensions: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionInstanceView] + :keyword boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. :code:`
    `:code:`
    ` You can easily + view the output of your console log. :code:`
    `:code:`
    ` Azure also enables you to see a + screenshot of the VM from the hypervisor. + :paramtype boot_diagnostics: ~azure.mgmt.compute.v2022_03_01.models.BootDiagnosticsInstanceView + :keyword statuses: The resource status information. + :paramtype statuses: list[~azure.mgmt.compute.v2022_03_01.models.InstanceViewStatus] + :keyword placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :paramtype placement_group_id: str + """ + super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) + self.platform_update_domain = platform_update_domain + self.platform_fault_domain = platform_fault_domain + self.rdp_thumb_print = rdp_thumb_print + self.vm_agent = vm_agent + self.maintenance_redeploy_status = maintenance_redeploy_status + self.disks = disks + self.extensions = extensions + self.vm_health = None + self.boot_diagnostics = boot_diagnostics + self.statuses = statuses + self.assigned_host = None + self.placement_group_id = placement_group_id + + +class 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. + + :ivar value: Required. The list of virtual machine scale sets VMs. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVM] + :ivar next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + ListNext() with this to fetch the next page of VMSS VMs. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["VirtualMachineScaleSetVM"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of virtual machine scale sets VMs. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVM] + :keyword next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + ListNext() with this to fetch the next page of VMSS VMs. + :paramtype next_link: str + """ + super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): + """Describes a virtual machine scale set VM network profile. + + :ivar network_interface_configurations: The list of network configurations. + :vartype network_interface_configurations: + list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ + + _attribute_map = { + 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, + } + + def __init__( + self, + *, + 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.v2022_03_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ + super(VirtualMachineScaleSetVMNetworkProfileConfiguration, self).__init__(**kwargs) + self.network_interface_configurations = network_interface_configurations + + +class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): + """Describes a virtual machine scale set virtual machine profile. + + :ivar os_profile: Specifies the operating system settings for the virtual machines in the scale + set. + :vartype os_profile: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetOSProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetStorageProfile + :ivar network_profile: Specifies properties of the network interfaces of the virtual machines + in the scale set. + :vartype network_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetNetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual + machines in the scale set. + :vartype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :ivar extension_profile: Specifies a collection of settings for extensions installed on virtual + machines in the scale set. + :vartype extension_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtensionProfile + :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: + :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. + :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". + :vartype priority: str or ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
    `:code:`
    `For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :vartype eviction_policy: str or + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineEvictionPolicyTypes + :ivar billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :vartype billing_profile: ~azure.mgmt.compute.v2022_03_01.models.BillingProfile + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2022_03_01.models.ScheduledEventsProfile + :ivar user_data: UserData for the virtual machines in the scale set, which must be base-64 + encoded. Customer should not pass any secrets in here. :code:`
    `:code:`
    `Minimum + api-version: 2021-03-01. + :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. + :vartype capacity_reservation: + ~azure.mgmt.compute.v2022_03_01.models.CapacityReservationProfile + :ivar application_profile: Specifies the gallery applications that should be made available to + the VM/VMSS. + :vartype application_profile: ~azure.mgmt.compute.v2022_03_01.models.ApplicationProfile + :ivar hardware_profile: Specifies the hardware profile related details of a scale set. + :code:`
    `:code:`
    `Minimum api-version: 2022-03-01. + :vartype hardware_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetHardwareProfile + """ + + _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'}, + 'hardware_profile': {'key': 'hardwareProfile', 'type': 'VirtualMachineScaleSetHardwareProfile'}, + } + + def __init__( + self, + *, + os_profile: Optional["VirtualMachineScaleSetOSProfile"] = None, + storage_profile: Optional["VirtualMachineScaleSetStorageProfile"] = None, + network_profile: Optional["VirtualMachineScaleSetNetworkProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + diagnostics_profile: Optional["DiagnosticsProfile"] = None, + extension_profile: Optional["VirtualMachineScaleSetExtensionProfile"] = None, + license_type: Optional[str] = None, + priority: Optional[Union[str, "VirtualMachinePriorityTypes"]] = None, + eviction_policy: Optional[Union[str, "VirtualMachineEvictionPolicyTypes"]] = None, + billing_profile: Optional["BillingProfile"] = None, + scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, + user_data: Optional[str] = None, + capacity_reservation: Optional["CapacityReservationProfile"] = None, + application_profile: Optional["ApplicationProfile"] = None, + hardware_profile: Optional["VirtualMachineScaleSetHardwareProfile"] = None, + **kwargs + ): + """ + :keyword os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :paramtype os_profile: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetOSProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetStorageProfile + :keyword network_profile: Specifies properties of the network interfaces of the virtual + machines in the scale set. + :paramtype network_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetNetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machines in the scale set. + :paramtype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :keyword extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :paramtype extension_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtensionProfile + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword priority: Specifies the priority for the virtual machines in the scale set. + :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values include: + "Regular", "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
    `:code:`
    `For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2022_03_01.models.BillingProfile + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2022_03_01.models.ScheduledEventsProfile + :keyword user_data: UserData for the virtual machines in the scale set, which must be base-64 + encoded. Customer should not pass any secrets in here. :code:`
    `:code:`
    `Minimum + api-version: 2021-03-01. + :paramtype user_data: str + :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.v2022_03_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.v2022_03_01.models.ApplicationProfile + :keyword hardware_profile: Specifies the hardware profile related details of a scale set. + :code:`
    `:code:`
    `Minimum api-version: 2022-03-01. + :paramtype hardware_profile: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetHardwareProfile + """ + super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) + self.os_profile = os_profile + self.storage_profile = storage_profile + self.network_profile = network_profile + self.security_profile = security_profile + self.diagnostics_profile = diagnostics_profile + self.extension_profile = extension_profile + self.license_type = license_type + self.priority = priority + self.eviction_policy = eviction_policy + self.billing_profile = billing_profile + self.scheduled_events_profile = scheduled_events_profile + self.user_data = user_data + self.capacity_reservation = capacity_reservation + self.application_profile = application_profile + self.hardware_profile = hardware_profile + + +class VirtualMachineScaleSetVMProtectionPolicy(msrest.serialization.Model): + """The protection policy of a virtual machine scale set VM. + + :ivar protect_from_scale_in: Indicates that the virtual machine scale set VM shouldn't be + considered for deletion during a scale-in operation. + :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. + :vartype 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, + *, + protect_from_scale_in: Optional[bool] = None, + 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 + + +class VirtualMachineSize(msrest.serialization.Model): + """Describes the properties of a VM size. + + :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. + :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. + :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 = { + '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, + *, + name: Optional[str] = None, + number_of_cores: Optional[int] = None, + os_disk_size_in_mb: Optional[int] = None, + resource_disk_size_in_mb: Optional[int] = None, + memory_in_mb: Optional[int] = None, + max_data_disk_count: Optional[int] = None, + **kwargs + ): + """ + :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 + self.os_disk_size_in_mb = os_disk_size_in_mb + self.resource_disk_size_in_mb = resource_disk_size_in_mb + self.memory_in_mb = memory_in_mb + self.max_data_disk_count = max_data_disk_count + + +class VirtualMachineSizeListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. + + :ivar value: The list of virtual machine sizes. + :vartype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineSize] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, + } + + def __init__( + self, + *, + value: Optional[List["VirtualMachineSize"]] = None, + **kwargs + ): + """ + :keyword value: The list of virtual machine sizes. + :paramtype value: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineSize] + """ + super(VirtualMachineSizeListResult, self).__init__(**kwargs) + self.value = value + + +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.v2022_03_01.models.VMGuestPatchRebootBehavior + :ivar activity_id: The activity ID of the operation that produced this result. It is used to + correlate across CRP and extension logs. + :vartype activity_id: str + :ivar published_date: The UTC timestamp when the repository published this patch. + :vartype published_date: ~datetime.datetime + :ivar last_modified_date_time: The UTC timestamp of the last update to this patch record. + :vartype last_modified_date_time: ~datetime.datetime + :ivar assessment_state: Describes the availability of a given patch. Possible values include: + "Unknown", "Available". + :vartype assessment_state: str or ~azure.mgmt.compute.v2022_03_01.models.PatchAssessmentState + """ + + _validation = { + 'patch_id': {'readonly': True}, + 'name': {'readonly': True}, + 'version': {'readonly': True}, + 'kb_id': {'readonly': True}, + 'classifications': {'readonly': True}, + 'reboot_behavior': {'readonly': True}, + 'activity_id': {'readonly': True}, + 'published_date': {'readonly': True}, + 'last_modified_date_time': {'readonly': True}, + 'assessment_state': {'readonly': True}, + } + + _attribute_map = { + 'patch_id': {'key': 'patchId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'kb_id': {'key': 'kbId', 'type': 'str'}, + 'classifications': {'key': 'classifications', 'type': '[str]'}, + 'reboot_behavior': {'key': 'rebootBehavior', 'type': 'str'}, + 'activity_id': {'key': 'activityId', 'type': 'str'}, + 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, + 'last_modified_date_time': {'key': 'lastModifiedDateTime', 'type': 'iso-8601'}, + 'assessment_state': {'key': 'assessmentState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualMachineSoftwarePatchProperties, self).__init__(**kwargs) + self.patch_id = None + self.name = None + self.version = None + self.kb_id = None + self.classifications = None + self.reboot_behavior = None + self.activity_id = None + self.published_date = None + self.last_modified_date_time = None + self.assessment_state = None + + +class VirtualMachineStatusCodeCount(msrest.serialization.Model): + """The status code and count of the virtual machine scale set instance view status summary. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The instance view status code. + :vartype code: str + :ivar count: The number of instances having a particular status code. + :vartype count: int + """ + + _validation = { + 'code': {'readonly': True}, + 'count': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) + self.code = None + self.count = None + + +class VirtualMachineUpdate(UpdateResource): + """Describes a Virtual Machine Update. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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**. + :vartype plan: ~azure.mgmt.compute.v2022_03_01.models.Plan + :ivar identity: The identity of the virtual machine, if configured. + :vartype identity: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineIdentity + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.compute.v2022_03_01.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.compute.v2022_03_01.models.StorageProfile + :ivar additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :vartype additional_capabilities: ~azure.mgmt.compute.v2022_03_01.models.AdditionalCapabilities + :ivar os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :vartype os_profile: ~azure.mgmt.compute.v2022_03_01.models.OSProfile + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.compute.v2022_03_01.models.NetworkProfile + :ivar security_profile: Specifies the Security related profile settings for the virtual + machine. + :vartype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :ivar diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :vartype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :ivar availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Availability sets overview + `_. + :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. + :vartype availability_set: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar virtual_machine_scale_set: Specifies information about the virtual machine scale set that + the virtual machine should be assigned to. Virtual machines specified in the same virtual + machine scale set are allocated to different nodes to maximize availability. Currently, a VM + can only be added to virtual machine scale set at creation time. An existing VM cannot be added + to a virtual machine scale set. :code:`
    `:code:`
    `This property cannot exist along with a + non-null properties.availabilitySet reference. :code:`
    `:code:`
    `Minimum api‐version: + 2019‐03‐01. + :vartype virtual_machine_scale_set: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar proximity_placement_group: Specifies information about the proximity placement group that + the virtual machine should be assigned to. :code:`
    `:code:`
    `Minimum api-version: + 2018-04-01. + :vartype proximity_placement_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar priority: Specifies the priority for the virtual machine. :code:`
    `:code:`
    `Minimum + api-version: 2019-03-01. Possible values include: "Regular", "Low", "Spot". + :vartype priority: str or ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePriorityTypes + :ivar eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
    `:code:`
    `For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :vartype eviction_policy: str or + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineEvictionPolicyTypes + :ivar billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :vartype billing_profile: ~azure.mgmt.compute.v2022_03_01.models.BillingProfile + :ivar host: Specifies information about the dedicated host that the virtual machine resides in. + :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :vartype host: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar host_group: Specifies information about the dedicated host group that the virtual machine + resides in. :code:`
    `:code:`
    `Minimum api-version: 2020-06-01. + :code:`
    `:code:`
    `NOTE: User cannot specify both host and hostGroup properties. + :vartype host_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine instance view. + :vartype instance_view: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineInstanceView + :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: + :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. + :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 + :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. + :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' + 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. + :vartype platform_fault_domain: int + :ivar scheduled_events_profile: Specifies Scheduled Event related configurations. + :vartype scheduled_events_profile: + ~azure.mgmt.compute.v2022_03_01.models.ScheduledEventsProfile + :ivar user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :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. + :vartype capacity_reservation: + ~azure.mgmt.compute.v2022_03_01.models.CapacityReservationProfile + :ivar application_profile: Specifies the gallery applications that should be made available to + the VM/VMSS. + :vartype application_profile: ~azure.mgmt.compute.v2022_03_01.models.ApplicationProfile + :ivar time_created: Specifies the time at which the Virtual Machine resource was + created.:code:`
    `:code:`
    `Minimum api-version: 2022-03-01. + :vartype time_created: ~datetime.datetime + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + 'vm_id': {'readonly': True}, + 'time_created': {'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'}, + 'time_created': {'key': 'properties.timeCreated', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + identity: Optional["VirtualMachineIdentity"] = None, + zones: Optional[List[str]] = None, + hardware_profile: Optional["HardwareProfile"] = None, + storage_profile: Optional["StorageProfile"] = None, + additional_capabilities: Optional["AdditionalCapabilities"] = None, + os_profile: Optional["OSProfile"] = None, + network_profile: Optional["NetworkProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + diagnostics_profile: Optional["DiagnosticsProfile"] = None, + availability_set: Optional["SubResource"] = None, + virtual_machine_scale_set: Optional["SubResource"] = None, + proximity_placement_group: Optional["SubResource"] = None, + priority: Optional[Union[str, "VirtualMachinePriorityTypes"]] = None, + eviction_policy: Optional[Union[str, "VirtualMachineEvictionPolicyTypes"]] = None, + billing_profile: Optional["BillingProfile"] = None, + host: Optional["SubResource"] = None, + host_group: Optional["SubResource"] = None, + license_type: Optional[str] = None, + extensions_time_budget: Optional[str] = None, + platform_fault_domain: Optional[int] = None, + scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, + user_data: Optional[str] = None, + capacity_reservation: Optional["CapacityReservationProfile"] = None, + 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.v2022_03_01.models.Plan + :keyword identity: The identity of the virtual machine, if configured. + :paramtype identity: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineIdentity + :keyword zones: The virtual machine zones. + :paramtype zones: list[str] + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.compute.v2022_03_01.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.compute.v2022_03_01.models.StorageProfile + :keyword additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :paramtype additional_capabilities: + ~azure.mgmt.compute.v2022_03_01.models.AdditionalCapabilities + :keyword os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :paramtype os_profile: ~azure.mgmt.compute.v2022_03_01.models.OSProfile + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.compute.v2022_03_01.models.NetworkProfile + :keyword security_profile: Specifies the Security related profile settings for the virtual + machine. + :paramtype security_profile: ~azure.mgmt.compute.v2022_03_01.models.SecurityProfile + :keyword diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :paramtype diagnostics_profile: ~azure.mgmt.compute.v2022_03_01.models.DiagnosticsProfile + :keyword availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Availability sets overview + `_. + :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Maintenance + and updates for Virtual Machines in Azure + `_ + :code:`
    `:code:`
    ` Currently, a VM can only be added to availability set at creation + time. The availability set to which the VM is being added should be under the same resource + group as the availability set resource. An existing VM cannot be added to an availability set. + :code:`
    `:code:`
    `This property cannot exist along with a non-null + properties.virtualMachineScaleSet reference. + :paramtype availability_set: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword virtual_machine_scale_set: Specifies information about the virtual machine scale set + that the virtual machine should be assigned to. Virtual machines specified in the same virtual + machine scale set are allocated to different nodes to maximize availability. Currently, a VM + can only be added to virtual machine scale set at creation time. An existing VM cannot be added + to a virtual machine scale set. :code:`
    `:code:`
    `This property cannot exist along with a + non-null properties.availabilitySet reference. :code:`
    `:code:`
    `Minimum api‐version: + 2019‐03‐01. + :paramtype virtual_machine_scale_set: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword proximity_placement_group: Specifies information about the proximity placement group + that the virtual machine should be assigned to. :code:`
    `:code:`
    `Minimum api-version: + 2018-04-01. + :paramtype proximity_placement_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :paramtype priority: str or ~azure.mgmt.compute.v2022_03_01.models.VirtualMachinePriorityTypes + :keyword eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
    `:code:`
    `For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :paramtype eviction_policy: str or + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineEvictionPolicyTypes + :keyword billing_profile: Specifies the billing related details of a Azure Spot virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :paramtype billing_profile: ~azure.mgmt.compute.v2022_03_01.models.BillingProfile + :keyword host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :paramtype host: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword host_group: Specifies information about the dedicated host group that the virtual + machine resides in. :code:`
    `:code:`
    `Minimum api-version: 2020-06-01. + :code:`
    `:code:`
    `NOTE: User cannot specify both host and hostGroup properties. + :paramtype host_group: ~azure.mgmt.compute.v2022_03_01.models.SubResource + :keyword license_type: Specifies that the image or disk that is being used was licensed + on-premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :paramtype license_type: str + :keyword extensions_time_budget: Specifies the time alloted for all extensions to start. The + time duration should be between 15 minutes and 120 minutes (inclusive) and should be specified + in ISO 8601 format. The default value is 90 minutes (PT1H30M). :code:`
    `:code:`
    ` Minimum + api-version: 2020-06-01. + :paramtype extensions_time_budget: str + :keyword platform_fault_domain: Specifies the scale set logical fault domain into which the + Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned + to a fault domain that best maintains balance across available fault + domains.:code:`
    `:code:`
  • `This is applicable only if the 'virtualMachineScaleSet' + property of this Virtual Machine is set.:code:`
  • `The Virtual Machine Scale Set that is + referenced, must have 'platformFaultDomainCount' > 1.:code:`
  • `This property cannot be + updated once the Virtual Machine is created.:code:`
  • `Fault domain assignment can be viewed + in the Virtual Machine Instance View.:code:`
    `:code:`
    `Minimum api‐version: 2020‐12‐01. + :paramtype platform_fault_domain: int + :keyword scheduled_events_profile: Specifies Scheduled Event related configurations. + :paramtype scheduled_events_profile: + ~azure.mgmt.compute.v2022_03_01.models.ScheduledEventsProfile + :keyword user_data: UserData for the VM, which must be base-64 encoded. Customer should not + pass any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :paramtype user_data: str + :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.v2022_03_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.v2022_03_01.models.ApplicationProfile + """ + super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) + self.plan = plan + self.identity = identity + self.zones = zones + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.additional_capabilities = additional_capabilities + self.os_profile = os_profile + self.network_profile = network_profile + self.security_profile = security_profile + self.diagnostics_profile = diagnostics_profile + self.availability_set = availability_set + self.virtual_machine_scale_set = virtual_machine_scale_set + self.proximity_placement_group = proximity_placement_group + self.priority = priority + self.eviction_policy = eviction_policy + self.billing_profile = billing_profile + self.host = host + self.host_group = host_group + self.provisioning_state = None + self.instance_view = None + self.license_type = license_type + self.vm_id = None + self.extensions_time_budget = extensions_time_budget + self.platform_fault_domain = platform_fault_domain + self.scheduled_events_profile = scheduled_events_profile + self.user_data = user_data + self.capacity_reservation = capacity_reservation + self.application_profile = application_profile + self.time_created = None + + +class VMDiskSecurityProfile(msrest.serialization.Model): + """Specifies the security profile settings for the managed disk. :code:`
    `:code:`
    ` NOTE: It can only be set for Confidential VMs. + + :ivar security_encryption_type: Specifies the EncryptionType of the managed disk. :code:`
    ` + It is set to DiskWithVMGuestState for encryption of the managed disk along with VMGuestState + blob, and VMGuestStateOnly for encryption of just the VMGuestState blob. + :code:`
    `:code:`
    ` NOTE: It can be set for only Confidential VMs. Possible values + include: "VMGuestStateOnly", "DiskWithVMGuestState". + :vartype security_encryption_type: str or + ~azure.mgmt.compute.v2022_03_01.models.SecurityEncryptionTypes + :ivar disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and + VMGuest blob. + :vartype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + """ + + _attribute_map = { + 'security_encryption_type': {'key': 'securityEncryptionType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + } + + def __init__( + self, + *, + security_encryption_type: Optional[Union[str, "SecurityEncryptionTypes"]] = None, + disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, + **kwargs + ): + """ + :keyword security_encryption_type: Specifies the EncryptionType of the managed disk. + :code:`
    ` It is set to DiskWithVMGuestState for encryption of the managed disk along with + VMGuestState blob, and VMGuestStateOnly for encryption of just the VMGuestState blob. + :code:`
    `:code:`
    ` NOTE: It can be set for only Confidential VMs. Possible values + include: "VMGuestStateOnly", "DiskWithVMGuestState". + :paramtype security_encryption_type: str or + ~azure.mgmt.compute.v2022_03_01.models.SecurityEncryptionTypes + :keyword disk_encryption_set: Specifies the customer managed disk encryption set resource id + for the managed disk that is used for Customer Managed Key encrypted ConfidentialVM OS Disk and + VMGuest blob. + :paramtype disk_encryption_set: + ~azure.mgmt.compute.v2022_03_01.models.DiskEncryptionSetParameters + """ + super(VMDiskSecurityProfile, self).__init__(**kwargs) + self.security_encryption_type = security_encryption_type + self.disk_encryption_set = disk_encryption_set + + +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. + + :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}. + :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. + :vartype configuration_reference: str + :ivar treat_failure_as_deployment_failure: Optional, If true, any failure for any operation in + the VmApplication will fail the deployment. + :vartype treat_failure_as_deployment_failure: bool + :ivar enable_automatic_upgrade: If set to true, when a new Gallery Application version is + available in PIR/SIG, it will be automatically updated for the VM/VMSS. + :vartype enable_automatic_upgrade: bool + """ + + _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'}, + 'treat_failure_as_deployment_failure': {'key': 'treatFailureAsDeploymentFailure', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'enableAutomaticUpgrade', 'type': 'bool'}, + } + + def __init__( + self, + *, + package_reference_id: str, + tags: Optional[str] = None, + order: Optional[int] = None, + configuration_reference: Optional[str] = None, + treat_failure_as_deployment_failure: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = 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 + :keyword treat_failure_as_deployment_failure: Optional, If true, any failure for any operation + in the VmApplication will fail the deployment. + :paramtype treat_failure_as_deployment_failure: bool + :keyword enable_automatic_upgrade: If set to true, when a new Gallery Application version is + available in PIR/SIG, it will be automatically updated for the VM/VMSS. + :paramtype enable_automatic_upgrade: bool + """ + super(VMGalleryApplication, self).__init__(**kwargs) + self.tags = tags + self.order = order + self.package_reference_id = package_reference_id + self.configuration_reference = configuration_reference + self.treat_failure_as_deployment_failure = treat_failure_as_deployment_failure + self.enable_automatic_upgrade = enable_automatic_upgrade + + +class VMScaleSetConvertToSinglePlacementGroupInput(msrest.serialization.Model): + """VMScaleSetConvertToSinglePlacementGroupInput. + + :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. + :vartype active_placement_group_id: str + """ + + _attribute_map = { + 'active_placement_group_id': {'key': 'activePlacementGroupId', 'type': 'str'}, + } + + def __init__( + self, + *, + 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 + + +class VMSizeProperties(msrest.serialization.Model): + """Specifies VM Size Property settings on the virtual machine. + + :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 + `_ . + :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. + :vartype 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, + *, + v_cpus_available: Optional[int] = None, + 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 + + +class WindowsConfiguration(msrest.serialization.Model): + """Specifies Windows operating system settings on the virtual machine. + + :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. + :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. + :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 + `_. + :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. + :vartype additional_unattend_content: + list[~azure.mgmt.compute.v2022_03_01.models.AdditionalUnattendContent] + :ivar patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Windows. + :vartype patch_settings: ~azure.mgmt.compute.v2022_03_01.models.PatchSettings + :ivar win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :vartype win_rm: ~azure.mgmt.compute.v2022_03_01.models.WinRMConfiguration + """ + + _attribute_map = { + 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, + 'enable_automatic_updates': {'key': 'enableAutomaticUpdates', 'type': 'bool'}, + 'time_zone': {'key': 'timeZone', 'type': 'str'}, + 'additional_unattend_content': {'key': 'additionalUnattendContent', 'type': '[AdditionalUnattendContent]'}, + 'patch_settings': {'key': 'patchSettings', 'type': 'PatchSettings'}, + 'win_rm': {'key': 'winRM', 'type': 'WinRMConfiguration'}, + } + + def __init__( + self, + *, + provision_vm_agent: Optional[bool] = None, + enable_automatic_updates: Optional[bool] = None, + time_zone: Optional[str] = None, + additional_unattend_content: Optional[List["AdditionalUnattendContent"]] = None, + patch_settings: Optional["PatchSettings"] = None, + win_rm: Optional["WinRMConfiguration"] = None, + **kwargs + ): + """ + :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.v2022_03_01.models.AdditionalUnattendContent] + :keyword patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Windows. + :paramtype patch_settings: ~azure.mgmt.compute.v2022_03_01.models.PatchSettings + :keyword win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :paramtype win_rm: ~azure.mgmt.compute.v2022_03_01.models.WinRMConfiguration + """ + super(WindowsConfiguration, self).__init__(**kwargs) + self.provision_vm_agent = provision_vm_agent + self.enable_automatic_updates = enable_automatic_updates + self.time_zone = time_zone + self.additional_unattend_content = additional_unattend_content + self.patch_settings = patch_settings + self.win_rm = win_rm + + +class WindowsParameters(msrest.serialization.Model): + """Input for InstallPatches on a Windows VM, as directly received by the API. + + :ivar classifications_to_include: The update classifications to select when installing patches + for Windows. + :vartype classifications_to_include: list[str or + ~azure.mgmt.compute.v2022_03_01.models.VMGuestPatchClassificationWindows] + :ivar kb_numbers_to_include: Kbs to include in the patch operation. + :vartype kb_numbers_to_include: list[str] + :ivar kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :vartype kb_numbers_to_exclude: list[str] + :ivar exclude_kbs_requiring_reboot: Filters out Kbs that don't have an + InstallationRebootBehavior of 'NeverReboots' when this is set to true. + :vartype exclude_kbs_requiring_reboot: bool + :ivar max_patch_publish_date: This is used to install patches that were published on or before + this given max published date. + :vartype max_patch_publish_date: ~datetime.datetime + """ + + _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, + *, + classifications_to_include: Optional[List[Union[str, "VMGuestPatchClassificationWindows"]]] = None, + kb_numbers_to_include: Optional[List[str]] = None, + kb_numbers_to_exclude: Optional[List[str]] = None, + exclude_kbs_requiring_reboot: Optional[bool] = None, + max_patch_publish_date: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword classifications_to_include: The update classifications to select when installing + patches for Windows. + :paramtype classifications_to_include: list[str or + ~azure.mgmt.compute.v2022_03_01.models.VMGuestPatchClassificationWindows] + :keyword kb_numbers_to_include: Kbs to include in the patch operation. + :paramtype kb_numbers_to_include: list[str] + :keyword kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :paramtype kb_numbers_to_exclude: list[str] + :keyword exclude_kbs_requiring_reboot: Filters out Kbs that don't have an + InstallationRebootBehavior of 'NeverReboots' when this is set to true. + :paramtype exclude_kbs_requiring_reboot: bool + :keyword max_patch_publish_date: This is used to install patches that were published on or + before this given max published date. + :paramtype max_patch_publish_date: ~datetime.datetime + """ + super(WindowsParameters, self).__init__(**kwargs) + self.classifications_to_include = classifications_to_include + self.kb_numbers_to_include = kb_numbers_to_include + self.kb_numbers_to_exclude = kb_numbers_to_exclude + self.exclude_kbs_requiring_reboot = exclude_kbs_requiring_reboot + self.max_patch_publish_date = max_patch_publish_date + + +class WindowsVMGuestPatchAutomaticByPlatformSettings(msrest.serialization.Model): + """Specifies additional settings to be applied when patch mode AutomaticByPlatform is selected in Windows patch settings. + + :ivar reboot_setting: Specifies the reboot setting for all AutomaticByPlatform patch + installation operations. Possible values include: "Unknown", "IfRequired", "Never", "Always". + :vartype reboot_setting: str or + ~azure.mgmt.compute.v2022_03_01.models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting + """ + + _attribute_map = { + 'reboot_setting': {'key': 'rebootSetting', 'type': 'str'}, + } + + def __init__( + self, + *, + reboot_setting: Optional[Union[str, "WindowsVMGuestPatchAutomaticByPlatformRebootSetting"]] = None, + **kwargs + ): + """ + :keyword reboot_setting: Specifies the reboot setting for all AutomaticByPlatform patch + installation operations. Possible values include: "Unknown", "IfRequired", "Never", "Always". + :paramtype reboot_setting: str or + ~azure.mgmt.compute.v2022_03_01.models.WindowsVMGuestPatchAutomaticByPlatformRebootSetting + """ + super(WindowsVMGuestPatchAutomaticByPlatformSettings, self).__init__(**kwargs) + self.reboot_setting = reboot_setting + + +class WinRMConfiguration(msrest.serialization.Model): + """Describes Windows Remote Management configuration of the VM. + + :ivar listeners: The list of Windows Remote Management listeners. + :vartype listeners: list[~azure.mgmt.compute.v2022_03_01.models.WinRMListener] + """ + + _attribute_map = { + 'listeners': {'key': 'listeners', 'type': '[WinRMListener]'}, + } + + def __init__( + self, + *, + listeners: Optional[List["WinRMListener"]] = None, + **kwargs + ): + """ + :keyword listeners: The list of Windows Remote Management listeners. + :paramtype listeners: list[~azure.mgmt.compute.v2022_03_01.models.WinRMListener] + """ + super(WinRMConfiguration, self).__init__(**kwargs) + self.listeners = listeners + + +class WinRMListener(msrest.serialization.Model): + """Describes Protocol and thumbprint of Windows Remote Management listener. + + :ivar protocol: Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :vartype protocol: str or ~azure.mgmt.compute.v2022_03_01.models.ProtocolTypes + :ivar certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + a secret. For adding a secret to the Key Vault, see `Add a key or secret to the key vault + `_. In this case, your + certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded + in UTF-8: :code:`
    `:code:`
    ` {:code:`
    ` + "data":":code:``",:code:`
    ` "dataType":"pfx",:code:`
    ` + "password":":code:``":code:`
    `} :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 + `_. + :vartype certificate_url: str + """ + + _attribute_map = { + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + protocol: Optional[Union[str, "ProtocolTypes"]] = None, + 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.v2022_03_01.models.ProtocolTypes + :keyword certificate_url: This is the URL of a certificate that has been uploaded to Key Vault + as a secret. For adding a secret to the Key Vault, see `Add a key or secret to the key vault + `_. In this case, your + certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded + in UTF-8: :code:`
    `:code:`
    ` {:code:`
    ` + "data":":code:``",:code:`
    ` "dataType":"pfx",:code:`
    ` + "password":":code:``":code:`
    `} :code:`
    ` To install certificates on a + virtual machine it is recommended to use the `Azure Key Vault virtual machine extension for + Linux `_ or the + `Azure Key Vault virtual machine extension for Windows + `_. + :paramtype certificate_url: str + """ + super(WinRMListener, self).__init__(**kwargs) + self.protocol = protocol + self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/__init__.py new file mode 100644 index 000000000000..9e7600d93081 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/__init__.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._usage_operations import UsageOperations +from ._virtual_machine_sizes_operations import VirtualMachineSizesOperations +from ._virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations +from ._virtual_machine_scale_set_extensions_operations import VirtualMachineScaleSetExtensionsOperations +from ._virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations +from ._virtual_machine_scale_set_vm_extensions_operations import VirtualMachineScaleSetVMExtensionsOperations +from ._virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations +from ._virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from ._virtual_machines_operations import VirtualMachinesOperations +from ._virtual_machine_images_operations import VirtualMachineImagesOperations +from ._virtual_machine_images_edge_zone_operations import VirtualMachineImagesEdgeZoneOperations +from ._virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations +from ._availability_sets_operations import AvailabilitySetsOperations +from ._proximity_placement_groups_operations import ProximityPlacementGroupsOperations +from ._dedicated_host_groups_operations import DedicatedHostGroupsOperations +from ._dedicated_hosts_operations import DedicatedHostsOperations +from ._ssh_public_keys_operations import SshPublicKeysOperations +from ._images_operations import ImagesOperations +from ._restore_point_collections_operations import RestorePointCollectionsOperations +from ._restore_points_operations import RestorePointsOperations +from ._capacity_reservation_groups_operations import CapacityReservationGroupsOperations +from ._capacity_reservations_operations import CapacityReservationsOperations +from ._log_analytics_operations import LogAnalyticsOperations +from ._virtual_machine_run_commands_operations import VirtualMachineRunCommandsOperations +from ._virtual_machine_scale_set_vm_run_commands_operations import VirtualMachineScaleSetVMRunCommandsOperations + +__all__ = [ + 'Operations', + 'UsageOperations', + 'VirtualMachineSizesOperations', + 'VirtualMachineScaleSetsOperations', + 'VirtualMachineScaleSetExtensionsOperations', + 'VirtualMachineScaleSetRollingUpgradesOperations', + 'VirtualMachineScaleSetVMExtensionsOperations', + 'VirtualMachineScaleSetVMsOperations', + 'VirtualMachineExtensionsOperations', + 'VirtualMachinesOperations', + 'VirtualMachineImagesOperations', + 'VirtualMachineImagesEdgeZoneOperations', + 'VirtualMachineExtensionImagesOperations', + 'AvailabilitySetsOperations', + 'ProximityPlacementGroupsOperations', + 'DedicatedHostGroupsOperations', + 'DedicatedHostsOperations', + 'SshPublicKeysOperations', + 'ImagesOperations', + 'RestorePointCollectionsOperations', + 'RestorePointsOperations', + 'CapacityReservationGroupsOperations', + 'CapacityReservationsOperations', + 'LogAnalyticsOperations', + 'VirtualMachineRunCommandsOperations', + 'VirtualMachineScaleSetVMRunCommandsOperations', +] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_availability_sets_operations.py new file mode 100644 index 000000000000..c4ec5c84272d --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_availability_sets_operations.py @@ -0,0 +1,798 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +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 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') +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', "2022-03-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', "2022-03-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', "2022-03-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="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + availability_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def create_or_update( + self, + 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. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.AvailabilitySet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore + + + @distributed_trace + def update( + self, + 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. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.AvailabilitySetUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore + + + @distributed_trace + def get( + self, + 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. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + 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'. 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.v2022_03_01.models.AvailabilitySetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets"} # type: ignore + + @distributed_trace + def list( + self, + 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.v2022_03_01.models.AvailabilitySetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets"} # type: ignore + + @distributed_trace + def list_available_sizes( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_available_sizes.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_capacity_reservation_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_capacity_reservation_groups_operations.py new file mode 100644 index 000000000000..9fdbbc3fee2d --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_capacity_reservation_groups_operations.py @@ -0,0 +1,716 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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') +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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def create_or_update( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Create capacity reservation Group. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.CapacityReservationGroup + :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.v2022_03_01.models.CapacityReservationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CapacityReservationGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CapacityReservationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param parameters: Parameters supplied to the Update capacity reservation Group operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.CapacityReservationGroupUpdate + :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.v2022_03_01.models.CapacityReservationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CapacityReservationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + 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 + https://aka.ms/CapacityReservation for more details. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :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: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore + + + @distributed_trace + def get( + self, + 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. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :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. Default value is None. + :type expand: str or + ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.CapacityReservationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityReservationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CapacityReservationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}"} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + 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. + + :param resource_group_name: The name of the 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. Default value is None. + :type expand: str or + ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.CapacityReservationGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups"} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + 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. Default value is None. + :type expand: str or + ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.CapacityReservationGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_capacity_reservations_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_capacity_reservations_operations.py new file mode 100644 index 000000000000..82211a75d562 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_capacity_reservations_operations.py @@ -0,0 +1,792 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CapacityReservation', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CapacityReservation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Create capacity reservation. + :type parameters: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + 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) + + 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 + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CapacityReservation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: 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. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. + :type capacity_reservation_name: str + :param parameters: Parameters supplied to the Update capacity reservation operation. + :type parameters: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.CapacityReservation] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + 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) + + 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 + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. + :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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + 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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param capacity_reservation_group_name: The name of the capacity reservation group. + :type capacity_reservation_group_name: str + :param capacity_reservation_name: The name of the capacity reservation. + :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. Default value is None. + :type expand: str or + ~azure.mgmt.compute.v2022_03_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.v2022_03_01.models.CapacityReservation + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CapacityReservation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}"} # type: ignore + + + @distributed_trace + def list_by_capacity_reservation_group( + self, + resource_group_name: str, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :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.v2022_03_01.models.CapacityReservationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + 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 diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_dedicated_host_groups_operations.py new file mode 100644 index 000000000000..18a4996f0163 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_dedicated_host_groups_operations.py @@ -0,0 +1,686 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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') +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', "2022-03-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', "2022-03-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', "2022-03-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] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_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, + host_group_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def create_or_update( + self, + 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). + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore + + + @distributed_trace + def update( + self, + 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. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroupUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore + + + @distributed_trace + def get( + self, + 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. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param expand: The expand expression to apply on the operation. '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. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}"} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + 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.v2022_03_01.models.DedicatedHostGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups"} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **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.v2022_03_01.models.DedicatedHostGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_dedicated_hosts_operations.py new file mode 100644 index 000000000000..d0d6206aa998 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_dedicated_hosts_operations.py @@ -0,0 +1,935 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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', "2022-03-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] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_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, + 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', "2022-03-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', "2022-03-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 + ) + + +def build_restart_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', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart") # 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] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class DedicatedHostsOperations(object): + """DedicatedHostsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + 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. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host . + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHost + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DedicatedHost', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + 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. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host . + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHostUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.DedicatedHost] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DedicatedHost', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host. + :type host_name: str + :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the list of instance views of the dedicated host. 'UserData' is not supported for dedicated + host. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHost, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.DedicatedHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}"} # type: ignore + + + @distributed_trace + def list_by_host_group( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedHostListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_03_01.models.DedicatedHostListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_host_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts"} # type: ignore + + def _restart_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_restart_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._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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart"} # type: ignore + + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Restart the dedicated host. The operation will complete successfully once the dedicated host + has restarted and is running. To determine the health of VMs deployed on the dedicated host + after the restart check the Resource Health Center in the Azure Portal. Please refer to + https://docs.microsoft.com/en-us/azure/service-health/resource-health-overview for more + details. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host. + :type host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + 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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}/restart"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_images_operations.py new file mode 100644 index 000000000000..08ed41ab5310 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_images_operations.py @@ -0,0 +1,847 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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', "2022-03-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] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + image_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Image', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + 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. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.Image + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.Image] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Image', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Image', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + 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. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.ImageUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.Image] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Image', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + image_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes an Image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + image_name=image_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.Image + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}"} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: + """Gets the list of images under a resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ImageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_03_01.models.ImageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images"} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.ImageListResult"]: + """Gets the list of Images in the subscription. Use nextLink property in the response to get the + next page of Images. Do this till nextLink is null to fetch all the Images. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ImageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_03_01.models.ImageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_log_analytics_operations.py new file mode 100644 index 000000000000..5fc63e7ffd18 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_log_analytics_operations.py @@ -0,0 +1,376 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _export_request_rate_by_interval_initial( + self, + location: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _export_request_rate_by_interval_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval"} # type: ignore + + + @distributed_trace + def begin_export_request_rate_by_interval( + self, + 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. + + :param location: The location upon which virtual-machine-sizes is queried. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.RequestRateByIntervalInput + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._export_request_rate_by_interval_initial( + location=location, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _export_throttled_requests_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore + + + @distributed_trace + def begin_export_throttled_requests( + self, + 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. + + :param location: The location upon which virtual-machine-sizes is queried. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getThrottledRequests Api. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.ThrottledRequestsInput + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.LogAnalyticsOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._export_throttled_requests_initial( + location=location, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_export_throttled_requests.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_operations.py new file mode 100644 index 000000000000..48353c766851 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_operations.py @@ -0,0 +1,145 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +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 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 +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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **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.v2022_03_01.models.ComputeOperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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) + + else: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.Compute/operations"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_proximity_placement_groups_operations.py new file mode 100644 index 000000000000..8a1551448e0d --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_proximity_placement_groups_operations.py @@ -0,0 +1,681 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +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 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') +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', "2022-03-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', "2022-03-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', "2022-03-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] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_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, + proximity_placement_group_name: str, + subscription_id: str, + *, + include_colocation_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def create_or_update( + self, + 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. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProximityPlacementGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore + + + @distributed_trace + def update( + self, + 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. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroupUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProximityPlacementGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore + + + @distributed_trace + def get( + self, + 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. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param include_colocation_status: includeColocationStatus=true enables fetching the colocation + status of all the resources in the proximity placement group. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **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.v2022_03_01.models.ProximityPlacementGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + 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.v2022_03_01.models.ProximityPlacementGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_restore_point_collections_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_restore_point_collections_operations.py new file mode 100644 index 000000000000..69898ec47fb5 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_restore_point_collections_operations.py @@ -0,0 +1,739 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def create_or_update( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Create or Update restore point collection + operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestorePointCollection, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('RestorePointCollection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RestorePointCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: 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. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. + :type restore_point_collection_name: str + :param parameters: Parameters supplied to the Update restore point collection operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollectionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestorePointCollection, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorePointCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + 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: 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the Restore Point Collection. + :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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + restore_point_collection_name=restore_point_collection_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :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. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RestorePointCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorePointCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + **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.v2022_03_01.models.RestorePointCollectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections"} # type: ignore + + @distributed_trace + def list_all( + self, + **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.v2022_03_01.models.RestorePointCollectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_restore_points_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_restore_points_operations.py new file mode 100644 index 000000000000..1283d4f5f484 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_restore_points_operations.py @@ -0,0 +1,483 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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, + *, + expand: Optional[Union[str, "_models.RestorePointExpandOptions"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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] + 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 RestorePointsOperations(object): + """RestorePointsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_initial( + self, + 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorePoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. + :type restore_point_name: str + :param parameters: Parameters supplied to the Create restore point operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.RestorePoint + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.RestorePoint] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + 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) + + 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 + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param restore_point_collection_name: The name of the Restore Point Collection. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. + :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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + 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) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: str, + restore_point_collection_name: str, + restore_point_name: str, + expand: Optional[Union[str, "_models.RestorePointExpandOptions"]] = None, + **kwargs: Any + ) -> "_models.RestorePoint": + """The operation to get the restore point. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param restore_point_collection_name: The name of the restore point collection. + :type restore_point_collection_name: str + :param restore_point_name: The name of the restore point. + :type restore_point_name: str + :param expand: The expand expression to apply on the operation. 'InstanceView' retrieves + information about the run-time state of a restore point. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_01.models.RestorePointExpandOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestorePoint, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RestorePoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = kwargs.pop('api_version', "2022-03-01") # type: 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, + expand=expand, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorePoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_ssh_public_keys_operations.py new file mode 100644 index 000000000000..15c4d9633be6 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_ssh_public_keys_operations.py @@ -0,0 +1,770 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +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 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') +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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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="DELETE", + url=_url, + params=_query_parameters, + headers=_header_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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_subscription( + self, + **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.v2022_03_01.models.SshPublicKeysGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + 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.v2022_03_01.models.SshPublicKeysGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys"} # type: ignore + + @distributed_trace + def create( + self, + 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. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore + + + @distributed_trace + def update( + self, + 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. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyUpdateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore + + + @distributed_trace + def get( + self, + 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. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}"} # type: ignore + + + @distributed_trace + def generate_key_pair( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyGenerateKeyPairResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.SshPublicKeyGenerateKeyPairResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyGenerateKeyPairResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyGenerateKeyPairResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_key_pair.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_usage_operations.py new file mode 100644 index 000000000000..9867ca50cee6 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_usage_operations.py @@ -0,0 +1,159 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +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 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( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + 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. + + :param location: The location for which resource usage is queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListUsagesResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_03_01.models.ListUsagesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_extension_images_operations.py new file mode 100644 index 000000000000..1534c73f1c8b --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_extension_images_operations.py @@ -0,0 +1,369 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 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( + location: str, + publisher_name: str, + type: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + 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. + :type location: str + :param publisher_name: + :type publisher_name: str + :param type: + :type type: str + :param version: + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineExtensionImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtensionImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtensionImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}"} # type: ignore + + + @distributed_trace + def list_types( + self, + 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. + :type location: str + :param publisher_name: + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineExtensionImage, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineExtensionImage"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineExtensionImage]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_types.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types"} # type: ignore + + + @distributed_trace + def list_versions( + self, + 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. + :type location: str + :param publisher_name: + :type publisher_name: str + :param type: + :type type: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str + :param top: Default value is None. + :type top: int + :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) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineExtensionImage"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineExtensionImage]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_versions.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_extensions_operations.py new file mode 100644 index 000000000000..75bb957d1e8e --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_extensions_operations.py @@ -0,0 +1,768 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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', "2022-03-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] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be created or + updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtension + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. + :type extension_parameters: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be deleted. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the extension. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace + def list( + self, + 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. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineExtensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtensionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtensionsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_images_edge_zone_operations.py new file mode 100644 index 000000000000..2280301d8ff4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_images_edge_zone_operations.py @@ -0,0 +1,604 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 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( + 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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + 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. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param version: A valid image SKU version. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}"} # type: ignore + + + @distributed_trace + def list( + self, + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of all virtual machine image versions for the specified location, edge zone, + publisher, offer, and SKU. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :param top: An integer value specifying the number of images to return that matches supplied + 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) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions"} # type: ignore + + + @distributed_trace + def list_offers( + self, + 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. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_offers.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers"} # type: ignore + + + @distributed_trace + def list_publishers( + self, + 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. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_publishers.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers"} # type: ignore + + + @distributed_trace + def list_skus( + self, + 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. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_skus.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_images_operations.py new file mode 100644 index 000000000000..8e5b549d6268 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_images_operations.py @@ -0,0 +1,570 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 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( + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + 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. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param version: A valid image SKU version. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}"} # type: ignore + + + @distributed_trace + def list( + self, + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs: Any + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of all virtual machine image versions for the specified location, publisher, offer, + and SKU. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param expand: The expand expression to apply on the operation. Default value is None. + :type expand: str + :param top: Default value is None. + :type top: int + :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) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions"} # type: ignore + + + @distributed_trace + def list_offers( + self, + 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. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_offers.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers"} # type: ignore + + + @distributed_trace + def list_publishers( + self, + 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. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_publishers.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers"} # type: ignore + + + @distributed_trace + def list_skus( + self, + 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. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_skus.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_run_commands_operations.py new file mode 100644 index 000000000000..d05abc7a3c23 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_run_commands_operations.py @@ -0,0 +1,1008 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + 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.v2022_03_01.models.RunCommandListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands"} # type: ignore + + @distributed_trace + def get( + self, + 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. + :type location: str + :param command_id: The command id. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandDocument, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RunCommandDocument + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandDocument"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RunCommandDocument', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace + 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 + ) -> LROPoller["_models.VirtualMachineRunCommand"]: + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be created or + updated. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace + 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 + ) -> LROPoller["_models.VirtualMachineRunCommand"]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be updated. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be deleted. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the run command. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineRunCommand + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_virtual_machine.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace + def list_by_virtual_machine( + self, + 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. 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.v2022_03_01.models.VirtualMachineRunCommandsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_virtual_machine.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_extensions_operations.py new file mode 100644 index 000000000000..acc54ee15a40 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -0,0 +1,791 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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', "2022-03-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] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + subscription_id: str, + *, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be create or + updated. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. + :type extension_parameters: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtension + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be updated. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. + :type extension_parameters: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtensionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSetExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be deleted. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set containing the extension. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}"} # type: ignore + + + @distributed_trace + def list( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set containing the extension. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetExtensionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py new file mode 100644 index 000000000000..d14917c7c290 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -0,0 +1,567 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 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 +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', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_os_upgrade_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_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', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_latest_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _cancel_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_cancel_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._cancel_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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _cancel_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore + + + @distributed_trace + def begin_cancel( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._cancel_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel"} # type: ignore + + def _start_os_upgrade_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_start_os_upgrade_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_os_upgrade_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore + + + @distributed_trace + def begin_start_os_upgrade( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_os_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start_os_upgrade.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade"} # type: ignore + + def _start_extension_upgrade_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_extension_upgrade_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade"} # type: ignore + + + @distributed_trace + def begin_start_extension_upgrade( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_extension_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RollingUpgradeStatusInfo, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RollingUpgradeStatusInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RollingUpgradeStatusInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RollingUpgradeStatusInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_latest.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py new file mode 100644 index 000000000000..2bd282cc8824 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -0,0 +1,804 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. + :type extension_parameters: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMExtension + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs: Any + ) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. + :type extension_parameters: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMExtensionUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSetVMExtension] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}"} # type: ignore + + + @distributed_trace + def list( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMExtensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtensionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtensionsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions"} # type: ignore + diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py new file mode 100644 index 000000000000..304f125556eb --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -0,0 +1,838 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + *, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + run_command=run_command, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineRunCommand] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + run_command=run_command, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param expand: The expand expression to apply on the operation. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineRunCommand + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}"} # type: ignore + + + @distributed_trace + def list( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. 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.v2022_03_01.models.VirtualMachineRunCommandsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vms_operations.py new file mode 100644 index 000000000000..b49e43678e34 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -0,0 +1,2364 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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 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] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # 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_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', "2022-03-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', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # 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_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', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_run_command_request_initial( + resource_group_name: str, + vm_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', "2022-03-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 + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _reimage_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_scale_set_vm_reimage_input is not None: + _json = self._serialize.body(vm_scale_set_vm_reimage_input, 'VirtualMachineScaleSetVMReimageParameters') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage"} # type: ignore + + + @distributed_trace + def begin_reimage( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + Default value is None. + :type vm_scale_set_vm_reimage_input: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMReimageParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_reimage_all_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_all_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall"} # type: ignore + + + @distributed_trace + def begin_reimage_all( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_deallocate_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate"} # type: ignore + + + @distributed_trace + def begin_deallocate( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be create or + updated. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVM + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSetVM] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param force_deletion: Optional parameter to force delete a virtual machine from a VM scale + set. (Feature in Preview). 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + force_deletion=force_deletion, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. 'InstanceView' will retrieve + the instance view of the virtual machine. 'UserData' will retrieve the UserData of the virtual + machine. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVM, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVM + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}"} # type: ignore + + + @distributed_trace + def get_instance_view( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVMInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: 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. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the VM scale set. + :type virtual_machine_scale_set_name: str + :param filter: The filter to apply to the operation. Allowed values are + 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied + eq true', 'properties/latestModelApplied eq false'. 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'. 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.v2022_03_01.models.VirtualMachineScaleSetVMListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines"} # type: ignore + + def _power_off_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"} # type: ignore + + + @distributed_trace + def begin_power_off( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + skip_shutdown=skip_shutdown, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_restart_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"} # type: ignore + + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_start_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"} # type: ignore + + + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_redeploy_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy"} # type: ignore + + + @distributed_trace + def begin_redeploy( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with + a value between 1 to 1440 minutes. :code:`
    `:code:`
    `NOTE: If not specified, SAS URIs + will be generated with a default expiration duration of 120 minutes. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RetrieveBootDiagnosticsDataResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RetrieveBootDiagnosticsDataResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RetrieveBootDiagnosticsDataResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData"} # type: ignore + + + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_perform_maintenance_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore + + + @distributed_trace + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance"} # type: ignore + + @distributed_trace + def simulate_eviction( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + simulate_eviction.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction"} # type: ignore + + + def _run_command_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore + + + @distributed_trace + 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 + ) -> LROPoller["_models.RunCommandResult"]: + """Run command on a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. + :type parameters: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._run_command_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RunCommandResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_sets_operations.py new file mode 100644 index 000000000000..4aa717b2dced --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_scale_sets_operations.py @@ -0,0 +1,3357 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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] + 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] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + force_deletion: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_instance_view_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_restart_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_perform_maintenance_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_instances_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_all_request_initial( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_force_recovery_service_fabric_platform_update_domain_walk_request( + resource_group_name: str, + vm_scale_set_name: str, + subscription_id: str, + *, + platform_update_domain: int, + zone: Optional[str] = None, + placement_group_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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') + if zone is not None: + _query_parameters['zone'] = _SERIALIZER.query("zone", zone, 'str') + if placement_group_id is not None: + _query_parameters['placementGroupId'] = _SERIALIZER.query("placement_group_id", placement_group_id, '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_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', "2022-03-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}/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') + _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_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', "2022-03-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}/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') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class VirtualMachineScaleSetsOperations(object): # pylint: disable=too-many-public-methods + """VirtualMachineScaleSetsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_location( + self, + 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.v2022_03_01.models.VirtualMachineScaleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets"} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The scale set object. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSet + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The scale set object. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineScaleSet] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param force_deletion: Optional parameter to force delete a VM scale set. (Feature in Preview). + 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + force_deletion=force_deletion, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param expand: The expand expression to apply on the operation. 'UserData' retrieves the + UserData property of the VM scale set that was provided by the user during the VM scale set + Create/Update operation. Default value is None. + :type expand: str or ~azure.mgmt.compute.v2022_03_01.models.ExpandTypesForGetVMScaleSets + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"} # type: ignore + + + def _deallocate_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"} # type: ignore + + + @distributed_trace + def begin_deallocate( # pylint: disable=inconsistent-return-statements + self, + 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. + + :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. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"} # type: ignore + + + @distributed_trace + def begin_delete_instances( # pylint: disable=inconsistent-return-statements + self, + 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. + :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.v2022_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :param force_deletion: Optional parameter to force delete virtual machines from the 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + force_deletion=force_deletion, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView"} # type: ignore + + + @distributed_trace + def list( + self, + 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.v2022_03_01.models.VirtualMachineScaleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets"} # type: ignore + + @distributed_trace + def list_all( + self, + **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.v2022_03_01.models.VirtualMachineScaleSetListWithLinkResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets"} # type: ignore + + @distributed_trace + def list_skus( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetListSkusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_skus.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus"} # type: ignore + + @distributed_trace + def get_os_upgrade_history( + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + get_os_upgrade_history.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory"} # type: ignore + + def _power_off_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore + + + @distributed_trace + def begin_power_off( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. 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. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + skip_shutdown=skip_shutdown, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_power_off.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"} # type: ignore + + def _restart_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore + + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements + self, + 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. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"} # type: ignore + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore + + + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements + self, + 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. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"} # type: ignore + + def _redeploy_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy"} # type: ignore + + + @distributed_trace + def begin_redeploy( # pylint: disable=inconsistent-return-statements + self, + 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. + + :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. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance"} # type: ignore + + + @distributed_trace + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements + self, + 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: + https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-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_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 = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_instances_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"} # type: ignore + + + @distributed_trace + def begin_update_instances( # pylint: disable=inconsistent-return-statements + self, + 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. + :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.v2022_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_scale_set_reimage_input is not None: + _json = self._serialize.body(vm_scale_set_reimage_input, 'VirtualMachineScaleSetReimageParameters') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore + + + @distributed_trace + def begin_reimage( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. Default value is None. + :type vm_scale_set_reimage_input: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetReimageParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_scale_set_reimage_input=vm_scale_set_reimage_input, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_reimage.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage"} # type: ignore + + def _reimage_all_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if vm_instance_i_ds is not None: + _json = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_all_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall"} # type: ignore + + + @distributed_trace + def begin_reimage_all( # pylint: disable=inconsistent-return-statements + self, + 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. + + :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. Default + value is None. + :type vm_instance_i_ds: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: str, + vm_scale_set_name: str, + platform_update_domain: int, + zone: Optional[str] = None, + placement_group_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.RecoveryWalkResponse": + """Manual platform update domain walk to update virtual machines in a service fabric virtual + machine scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param platform_update_domain: The platform update domain for which a manual recovery walk is + requested. + :type platform_update_domain: int + :param zone: The zone in which the manual recovery walk is requested for cross zone virtual + machine scale set. Default value is None. + :type zone: str + :param placement_group_id: The placement group id for which the manual recovery walk is + requested. Default value is None. + :type placement_group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecoveryWalkResponse, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RecoveryWalkResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryWalkResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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, + zone=zone, + placement_group_id=placement_group_id, + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecoveryWalkResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk"} # type: ignore + + + @distributed_trace + def convert_to_single_placement_group( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The input object for ConvertToSinglePlacementGroup API. + :type parameters: + ~azure.mgmt.compute.v2022_03_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + + request = build_convert_to_single_placement_group_request( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + convert_to_single_placement_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup"} # type: ignore + + + def _set_orchestration_service_state_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + + request = build_set_orchestration_service_state_request_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + subscription_id=self._config.subscription_id, + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _set_orchestration_service_state_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore + + + @distributed_trace + def begin_set_orchestration_service_state( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The input object for SetOrchestrationServiceState API. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.OrchestrationServiceStateInput + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._set_orchestration_service_state_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_set_orchestration_service_state.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_sizes_operations.py new file mode 100644 index 000000000000..063267e92dba --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machine_sizes_operations.py @@ -0,0 +1,161 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +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 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( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + 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.v2022_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machines_operations.py new file mode 100644 index 000000000000..581010528233 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/operations/_virtual_machines_operations.py @@ -0,0 +1,3490 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, 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 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 +from .._vendor import _convert_request, _format_url_section +T = 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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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', "2022-03-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 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] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_deallocate_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + *, + hibernate: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_generalize_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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] + if filter is not None: + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, '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_all_request( + subscription_id: str, + *, + status_only: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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') + if filter is not None: + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +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', "2022-03-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', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # 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_reapply_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_redeploy_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_reimage_request_initial( + 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', "2022-03-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}/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') + _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_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', "2022-03-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', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # 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_simulate_eviction_request( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # 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') + + # 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_assess_patches_request_initial( + resource_group_name: str, + vm_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-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', "2022-03-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', "2022-03-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 + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2022_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_location( + self, + 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.v2022_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines"} # type: ignore + + def _capture_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineCaptureResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _capture_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"} # type: ignore + + + @distributed_trace + def begin_capture( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineCaptureParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineCaptureResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._capture_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineCaptureResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachine + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachine', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachine] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachine', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + 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. 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + force_deletion=force_deletion, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param expand: The expand expression to apply on the operation. 'InstanceView' retrieves a + 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.v2022_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachine, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachine + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"} # type: ignore + + + @distributed_trace + def instance_view( + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + instance_view.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView"} # type: ignore + + + def _convert_to_managed_disks_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_convert_to_managed_disks_request_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + subscription_id=self._config.subscription_id, + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _convert_to_managed_disks_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks"} # type: ignore + + + @distributed_trace + def begin_convert_to_managed_disks( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._convert_to_managed_disks_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore + + + @distributed_trace + def begin_deallocate( # pylint: disable=inconsistent-return-statements + self, + 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. + + :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 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._deallocate_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + hibernate=hibernate, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_deallocate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"} # type: ignore + + @distributed_trace + def generalize( # pylint: disable=inconsistent-return-statements + self, + 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 + `_.:code:`
    `For + Linux, please refer to `How to create an image of a virtual machine or VHD + `_. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + generalize.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + filter: Optional[str] = None, + **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 + :param filter: The system query option to filter VMs returned in the response. Allowed value is + 'virtualMachineScaleSet/id' eq + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines"} # type: ignore + + @distributed_trace + def list_all( + self, + status_only: Optional[str] = None, + filter: 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. Default value is None. + :type status_only: str + :param filter: The system query option to filter VMs returned in the response. Allowed value is + 'virtualMachineScaleSet/id' eq + /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}'. + Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + status_only=status_only, + filter=filter, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + status_only=status_only, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines"} # type: ignore + + @distributed_trace + def list_available_sizes( + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2022_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_available_sizes.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes"} # type: ignore + + def _power_off_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"} # type: ignore + + + @distributed_trace + def begin_power_off( # pylint: disable=inconsistent-return-statements + self, + 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. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. 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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + skip_shutdown=skip_shutdown, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reapply_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply"} # type: ignore + + + @distributed_trace + def begin_reapply( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reapply_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore + + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"} # type: ignore + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore + + + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"} # type: ignore + + def _redeploy_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore + + + @distributed_trace + def begin_redeploy( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_redeploy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy"} # type: ignore + + def _reimage_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if parameters is not None: + _json = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + else: + _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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage"} # type: ignore + + + @distributed_trace + def begin_reimage( # pylint: disable=inconsistent-return-statements + self, + 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. Default value + is None. + :type parameters: ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineReimageParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with + a value between 1 to 1440 minutes. :code:`
    `:code:`
    `NOTE: If not specified, SAS URIs + will be generated with a default expiration duration of 120 minutes. 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) + :rtype: ~azure.mgmt.compute.v2022_03_01.models.RetrieveBootDiagnosticsDataResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RetrieveBootDiagnosticsDataResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RetrieveBootDiagnosticsDataResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve_boot_diagnostics_data.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData"} # type: ignore + + + def _perform_maintenance_initial( # pylint: disable=inconsistent-return-statements + self, + 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 = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore + + + @distributed_trace + def begin_perform_maintenance( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_perform_maintenance.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance"} # type: ignore + + @distributed_trace + def simulate_eviction( # pylint: disable=inconsistent-return-statements + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + simulate_eviction.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction"} # type: ignore + + + def _assess_patches_initial( + self, + resource_group_name: 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 = kwargs.pop('api_version', "2022-03-01") # type: 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) + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineAssessPatchesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _assess_patches_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches"} # type: ignore + + + @distributed_trace + def begin_assess_patches( + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineAssessPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._assess_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineAssessPatchesResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineInstallPatchesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _install_patches_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches"} # type: ignore + + + @distributed_trace + def begin_install_patches( + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + :type install_patches_input: + ~azure.mgmt.compute.v2022_03_01.models.VirtualMachineInstallPatchesParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.VirtualMachineInstallPatchesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._install_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + install_patches_input=install_patches_input, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VirtualMachineInstallPatchesResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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: 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 = kwargs.pop('api_version', "2022-03-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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore + + + @distributed_trace + def begin_run_command( + self, + 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. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Run command operation. + :type parameters: ~azure.mgmt.compute.v2022_03_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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: 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.v2022_03_01.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-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( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._run_command_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + content_type=content_type, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('RunCommandResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand"} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/py.typed b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2022_03_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file